IsLoaded form in query

doran_doran

Registered User.
Local time
Today, 03:45
Joined
Aug 15, 2002
Messages
349
dont want to create 36 different query. There are 9 queries for the 9 sub reports embeded in one main report.

I want to use some kinda iif command if form # 1 is loaded then used filter # 1. But following code is asking me for start and end date for each form.. I guess i need to use switch. I know there are lots of genious people here. Can anyone mind sharing their genious brain.

Thanks
Jessica



IIf(isloaded([forms]![frmRptDueDates]),([tblDueDateMatrix].[Mail_Census_Date]) Between [forms]![frmRptDueDates]![txtStartDate] And [forms]![frmRptDueDates]![txtEndDate],IIf(isloaded([forms]![frmRptDueDatesUnit]),([tblDueDateMatrix].[Mail_Census_Date]) Between [forms]![frmRptDueDatesUnit]![txtStartDate] And [forms]![frmRptDueDatesUnit]![txtEndDate],IIf(isloaded([forms]![frmRptDueDatesTL]),([tblDueDateMatrix].[Mail_Census_Date]) Between [forms]![frmRptDueDatesTL]![txtStartDate] And [forms]![frmRptDueDatesTL]![txtEndDate],IIf(isloaded([forms]![frmRptDueDatesInd]),([tblDueDateMatrix].[Mail_Census_Date]) Between [forms]![frmRptDueDatesInd]![txtStartDate] And [forms]![frmRptDueDatesInd]![txtEndDate]))))
 
Jessica,

That's getting quite complex!

How about putting a Public Function in a module? Then you can reference
it in your query:

NewField: YourPublicFunction()

It would be much easier to express the logic in VBA.

btw,

What's the IIf supposed to return? I don't see any "false" components.

Wayne
 

Users who are viewing this thread

Back
Top Bottom