StartDate/EndDate question. (1 Viewer)

cross5900

Blarg!
Local time
Today, 11:23
Joined
Mar 24, 2006
Messages
92
I have the below code which works great. I would like to make an addition to this code where it will pull up all of the accounts if no date is entered into the startdate/enddate text boxes. I know I need to add the * somewhere, but not sure where.

Thanks in advance.

DoCmd.OpenReport "rptAgedbyAssociate", acViewPreview, , "FollowUpDate >= #" & Me.StartDate3 & "# And FollowUpDate <= #" & Me.EndDate3 & "# And Associate Like '*" & Me.assocbox1.Column(1) & "'"
 

MStCyr

New member
Local time
Today, 12:23
Joined
Sep 18, 2003
Messages
333
This will work for you:


Like IIf([Forms]![FindGuest]![txtStartDate]="","*","*" & [Forms]![FindGuest]![txtEndDate] & "*")
 

cross5900

Blarg!
Local time
Today, 11:23
Joined
Mar 24, 2006
Messages
92
Would it look like this? Is that right?

DoCmd.OpenReport "rptAgedbyAssociate", acViewPreview,, Like IIf([frmSupervisorOverview]![Associate]![StartDate3]="","*","*" & [frmSupervisorOverview]![Associate]![EndDate3] & "*")
 

MStCyr

New member
Local time
Today, 12:23
Joined
Sep 18, 2003
Messages
333
That does not seem right.... you must start with the Forms collection ( Forms) and then the form you are referencing and then the control itself, hence Forms!FormYouAreReferencing!ControlOnTheForm



----------------------------------------------------------------
Would it look like this? Is that right?

DoCmd.OpenReport "rptAgedbyAssociate", acViewPreview,, Like IIf([frmSupervisorOverview]![Associate]![StartDate3]="","*","*" & [frmSupervisorOverview]![Associate]![EndDate3] & "*")
 

cross5900

Blarg!
Local time
Today, 11:23
Joined
Mar 24, 2006
Messages
92
Thanks for the assistance, I decided to follow something a little different.

If Nz(StartDate3, "") = "" Or Nz(EndDate3, "") = "" Then
DoCmd.OpenReport "rptAgedbyAssociate", acViewPreview, , "UserName Like '*" & Me.assocbox1.Column(1) & "'"
Else
DoCmd.OpenReport "rptAgedbyAssociate", acViewPreview, , "FollowUpDate >= #" & Me.StartDate3 & "# And FollowUpDate <= #" & Me.EndDate3 & "# And UserName Like '*" & Me.assocbox1.Column(1) & "'"
End If

Gave me exactly what I needed.
 

Users who are viewing this thread

Top Bottom