DLookUp in a form

  • Thread starter Charles via AccessMonster.com
  • Start date
C

Charles via AccessMonster.com

I have a form that I use for control buttons, I created a text box to enter
the date used by an append query to create a table for work schedules. I
added another text box with the following control: DLookUp("[Day_Txt]",
"tbl_Day","Weekday(ServDate)=[Day_Nr]") the result of this box would be used
as the criteria in a query to select the schedules for that particular day.
The problem is that the weekday text box is only updated if I click on the
design dispaly and then return to the form display. Is there a solution that
I can display the weekday based on the date displayed in the "ServDate" text
box?

Thanks
Charles
 
D

Douglas J. Steele

What exactly are you looking for? If ServDate contains a date, you can
determine the name of the day using

=Format(Me![ServDate], "ddd") (for Sun, Mon, Tue,...)

or

=Format(Me![ServDate], "dddd") (for Sunday, Monday, Tuesday,...)


As to why your DLookup didn't work, you need to ensure that you're passing a
value, not a reference. In other words, you need

DLookUp("[Day_Txt]","tbl_Day",Weekday(ServDate) & "=[Day_Nr]")
 
C

charles via AccessMonster.com

Thank you.
Your variation of DLookUp works fine. This will allow me to delete 6 bottons
and 6 queries.

Thanks again

Charles
What exactly are you looking for? If ServDate contains a date, you can
determine the name of the day using

=Format(Me![ServDate], "ddd") (for Sun, Mon, Tue,...)

or

=Format(Me![ServDate], "dddd") (for Sunday, Monday, Tuesday,...)

As to why your DLookup didn't work, you need to ensure that you're passing a
value, not a reference. In other words, you need

DLookUp("[Day_Txt]","tbl_Day",Weekday(ServDate) & "=[Day_Nr]")
I have a form that I use for control buttons, I created a text box to enter
the date used by an append query to create a table for work schedules. I
[quoted text clipped - 12 lines]
Thanks
Charles
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top