set a variable with data from a table.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
i have a table with cloumns Dates, Te001, Te002, Te003 etc.....
In the dates column is a list of future dates. In the other columns are tick
boxes set to on or off.

I want a command button on a form to use part of the code to check whether a
specific box is ticked or not for a certain date.
I then want furhter code to follow depending on the result.
I decided to use a variable called DateTakenTrueFalse to contin this value
which can only be true or false (1 or 0)

I tried a DoCmd.runSQL ("SELECT Te003 FROM tblDates WHERE Dates = #" &
DateTakenTest & "#")= DateTakenTrueFalse

but this didn't work.

Any help would come highly appreciated.
Many thanks for your time.
 
Use the DLookup function to get a value of a single record from a table or
query:

DateTakenTrueFalse = DLookup("Te003", "tblDates", "Dates = #" &
DateTakenTest & "#")
 
I also need the date format to be the UK version with dd/mm/yy instead any
calculations assume american format mm/dd/yy which will prove very difficult
in later programming.

Thanks in advance
 
A date is a date! When it is displayed, you see it in whatever format
you (or in some cases Access!) have specified, but _calculations_ in
programming code and ordering in Queries or Recordsets do not depend
on the format in which a date was entered or the format in which it
may be displayed. The only major "gotcha" around dates and
"programming" in Access arises from the fact that date constants in
Where clauses (and, consequently, in Query parameters) are passed as
Strings and always interpreted as being in US (mm/dd/yyyy) format but
the default conversion from Date to String uses the local format - in
this context, you often have to use Format () to ensure that right
date format is used.

I also need the date format to be the UK version with dd/mm/yy instead any
calculations assume american format mm/dd/yy which will prove very difficult
in later programming.

Thanks in advance


Please respond to the Newsgroup, so that others may benefit from the exchange.
Peter R. Fletcher
 
Hi

I guess it is possible to do easely but i don't really understand what you
want. to do on your form.
 
Back
Top