iif in query

desireemm

Registered User.
Local time
Today, 01:47
Joined
Dec 30, 2003
Messages
64
IIf(IsNull([Forms]![REVISED FORMS]![Srch_TM#/APP#]),True,[TM#/APP#]=[Forms]![REVISED FORMS]![Srch_TM#/APP#])

I have this in a query to look up values for me and it works pretty good, I just want to be able to apply this to a form, trying to create my own seach form only instead of using TM#/APP# I want to use dates instead and I want to be able to make it into a form that users can put date ranges in(Example: 01/31/2003 to 1/31/2004) and a report comes up with those dates along with first and last name..etc.

Does that make any sense Or should I give a better explanation
 
desiree,

With your names substituted in this should work for the
OnClick event of your Report button.

Code:
If Not IsDate(Me.Date1) Or Not IsDate(Me.Date2) Then
   MsgBox("These are date fields")
   Exit Sub
End If
If Me.Date1 >= Me.Date2 Then
   MsgBox("2nd date should be greater")
   Exit Sub
End If
DoCmd.OpenReport "YourReport"

Then just base your report on a query. The query has
a date field with the Criteria:

Between Forms![YourForm]![Date1] And Forms![YourForm]![Date2]

Wayne
 

Users who are viewing this thread

Back
Top Bottom