Enable or Disable criteria

Azhar.iq

Registered User.
Local time
Today, 21:10
Joined
Apr 10, 2015
Messages
18
Is there a way in access, through vba or any other means, which would allow me to either enable or disable criteria in a query based on the value of textbox??

Like i have a query that displays bookings customer has made between two dates, so i made a query and in the starting and ending date fields i get the value from form. In case if the use does not enter ending date, i would like to run the query with starting date only that displays booking made after the starting date.

Currently the starting date criteria is set to a textbox of form, and so is ending date. So if customer selects 1st April 2015 as starting date and 30th April 2015 as ending date the query should display the bookings between 1st and 30th of April. And if the user enters only 1st April in starting date it should display bookings starting from 1st April onwards
 
You can wrap the 2 form references in the Nz() function, using an appropriate date for each (before and after any existing data).
 
Is this correct for the starting date, gave me an error of expression typed incorrectly or too complex to be evaluated.

>=Nz(CDate([Forms]![FrmDisplayReportBookingDates]![txtStartingDate]),1\1\2015)
 
Try

Nz([Forms]![FrmDisplayReportBookingDates]![txtStartingDate],#1/1/2015#)
 

Users who are viewing this thread

Back
Top Bottom