Dlookup returns blank :( (1 Viewer)

ahmed_optom

Registered User.
Local time
Today, 05:51
Joined
Oct 27, 2016
Messages
93
I am making a very simple diary.

I have made a table, it has ID, Patient ID, AppointmentDate and SlotNumber.

all im trying to do is have a text box that will fill with patient ID if the slotnumber and date is checked.

This is what im using now :

=DLookUp("[Patient ID]","[Diary]","[AppointmentDate]=#" & [Text13] & "# and [SlotNumber]=1")

For some reason it works only about 10% of the time. the rest of the time its just returns a blank, no error.

What I have noticed it works for the first use of the form, but if add another entry to the table for a different date, then it doesnt return anything. It only seems to work with one entry into the table. Obviously not useful :(

The way the form is organised, means there will only ever be one appointment for each day in each slot.

Any ideas?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:51
Joined
May 7, 2009
Messages
19,243
=DLookUp("[Patient ID]","[Diary]","[AppointmentDate]=" & Format([Text13], "\#mm\/dd\/yyyy\#") & " and [SlotNumber]=1")
 

Minty

AWF VIP
Local time
Today, 05:51
Joined
Jul 26, 2013
Messages
10,371
Are your dates UK style by any chance?

Try
=DLookUp("[Patient ID]","[Diary]","[AppointmentDate]=#" & Format(Me.[Text13],"yyyy/mm/dd") & "# and [SlotNumber]=1")

Worth a read here http://allenbrowne.com/ser-36.html for the how's and why's !
 

ahmed_optom

Registered User.
Local time
Today, 05:51
Joined
Oct 27, 2016
Messages
93
thanks guys.

I wish I could get back the 3 hours of headaches...
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:51
Joined
May 7, 2009
Messages
19,243
I have Panadol and Tugmuloron, which one you prefer?
 

Users who are viewing this thread

Top Bottom