if query is null

PipSmalls

New member
Local time
Today, 19:56
Joined
Apr 11, 2002
Messages
5
Hi,
can anyone tell me what is wrong with this function ? It keeps coming back as no data, even though there is a date set in the table.

Public Function ifdateexists()

If IsNull(DLookup("[TT.date]", "qry_TT", "[TT.date] =" & Forms!TT!frm_date![txt_searchdate])) Then

MsgBox "no data"
Exit Function
Else
MsgBox "Data"

End If


End Function
 
I've always found problems with dates and Domain Aggregate functions, much easier to use a combo box with the dates from your query in, then use the notinlist for invalid entries.
 
Thanks for the reply, but that would not really be suitable in this case.

Anyone any other ideas ?
could it be the [date] part ?

All i am looking to do is check if a record exists for a certain date..surely this must be simple ?
 
I used this to see if a date entered in a text box was also listed in a listbox of 'valid dates'...i don't know if it will help you, but it works.

Jennifer


If IsNull(DLookup("InventoryDate", "tblinventory", "InventoryDate = #" & Me.BeginDate & "#")) Then
MsgBox "Please choose a Beginning Inventory Date from the listbox of available Inventories!"
Me.BeginDate.SetFocus
Exit Sub
 

Users who are viewing this thread

Back
Top Bottom