UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
2 Pages V < 1 2  (Go to first unread post)
   Reply to this topicStart new topic
> Make Report Visible, Access 2016    
 
   
mike60smart
post Feb 23 2020, 10:15 AM
Post#21


UtterAccess VIP
Posts: 13,726
Joined: 6-June 05
From: Dunbar,Scotland


Hi Bernie

Can you explain this part of the Lookup ?

"SomeCriteria",-1) = -1

--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 
pere_de_chipstic...
post Feb 23 2020, 12:31 PM
Post#22


UtterAccess Editor
Posts: 10,594
Joined: 8-November 07
From: South coast, England


Hi Mike

What the code attempting to do is to determine which subform is going to be displayed before the open report command is run.

Looking at your post #10
QUOTE
When the Report Opens - If txtCheck = 0 then make the Report (rptSummaryforReportBlanksubreport)Visible.

If it is > 0 then show the Other Report (rptSummaryforReportsubreport)Visible


Then the OpenArgs argument needs to be (say) 0 to make rptSummaryforReportBlanksubreport visible and -1 to make rptSummaryforReportsubreport visible

Hence, assuming that a null value is the same as 0, the dLookup can be changed to:[/color]
CODE
boltxtV  = NZ(DLookup ("txtCheck","SomeTableName", "SomeCriteria"), 0) = 0
DoCmd.OpenReport "rptAIAForPeriod", acViewPreview, "", "", acNormal, OpenArgs:= Cstr(boltxtV)


Then in the OnOpen event
CODE
Dim bolOpenArg as Boolean
bolOpenArg =  Cbool(Me.OpenArgs)
Me.rptSummaryforReportBlanksubreport.Visible = Not bolOpenArg
Me.rptSummaryforReportsubreport.Visible = bolOpenArg


The 'SomeCriteria' is to ensure that the same record is returned by the dlookup as is to be shown on the report, if txtCheck is a calculated value and your report uses a persistent query then you could perhaps use:
boltxtV = NZ(DLookup ("txtCheck","YourQueryName"), 0) = 0

hth

PS There was a missing bracket in my original post, boltxtV = NZ(DLookup ("txtCheck","SomeTableName", "SomeCriteria", 0) = 0 should have been boltxtV = NZ(DLookup ("txtCheck","SomeTableName", "SomeCriteria") , 0) = 0 blush.gif
This post has been edited by pere_de_chipstick: Feb 23 2020, 12:40 PM

--------------------
Warm regards
Bernie
Go to the top of the page
 
mike60smart
post Feb 23 2020, 01:02 PM
Post#23


UtterAccess VIP
Posts: 13,726
Joined: 6-June 05
From: Dunbar,Scotland


Hi Bernie

Thanks for trying with this for me but I have now decided to go a different route and will start a new thread.

Many thanks yet again

cheers.gif

--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 
pere_de_chipstic...
post Feb 23 2020, 05:45 PM
Post#24


UtterAccess Editor
Posts: 10,594
Joined: 8-November 07
From: South coast, England


Hi Mike

I've produced a demo to illustrate the method I was suggesting, so have posted it anyway!

Open the form "frmReportSelect" - select a number from the combo box, click the OpenReport button

1 in the combo box will open the report with the left hand subreport visible
2 in the combo box will open the report with the right hand subreport visible

hth
Attached File(s)
Attached File  DemoDB.zip ( 51.47K )Number of downloads: 5
 

--------------------
Warm regards
Bernie
Go to the top of the page
 
Bullschmidt
post Mar 14 2020, 10:26 PM
Post#25



Posts: 31
Joined: 8-May 19
From: USA


Well the DLookup() function can take 2 or 3 parameters and the Nz() function can take 1 or 2 parameters. So how about if you change this:
Nz(DLookup("CoNo", "TableSummaryForReport", "CoNo", -1), -1)

To be more like this instead:
Nz(DLookup("CoNo", "TableSummaryForReport", "CoNo"), -1)
Or
Nz(DLookup("CoNo", "TableSummaryForReport", "CoNo"))

--------------------
J. Paul Schmidt - Freelance Web and Database Developer
Sample Database on the Web
Sample Access Database

Go to the top of the page
 
2 Pages V < 1 2


Custom Search


RSSSearch   Top   Lo-Fi    5th April 2020 - 01:45 AM