What is [Today]![isdate] - a form and field names?
Do what the error message instructs, try preceding the names with the collection reference:
Forms![Today]![isdate]
or just:
[isdate]
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
tried that...not using a form - I want the macro to check against a field in a table, is that possible
Would have to use expression with DLookup() domain aggregate function. Or maybe an sql SELECT statement, I think macros in 2010 can run sql statements, or maybe that is in data macros specifically. I don't use macros so not sure about the sql SELECT.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
thanks june7..I'm baffled why basic requests in access are still shrouded in code in 2013..I thought it would be as easy as to say...
If in table x, the date is y, then
don't execute this part of the macro...
That's what domain aggregate functions are for. They communicate instructions to Access. With DLookup the instruction is: look in table x and retrieve value from field y of first record that meets criteria.
If the table Today were included in the form's RecordSource then its fields would be available for direct reference by the macro, assuming this is an embedded macro behind the form.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
thank you Jun7. This is not a form though, just a macro of commands to open and run queries in order. I would like to run one of the queries only if a field in one of the tables of the db does not contain today's date. In other words, I am trying to find a logical way to run a query only once a day automatically by a macro.
Then use the DLookup to search table for the value.
If IsNull(DLookup("isdate", "Today", "isdate=#" & Date() & "#")) Then
'run code
Else
'do this
End If
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Wow, I think I am getting closer thanks to you!!! No more error message, the macro seems to be running, I just need to figure out if I have my logic right. I'll keep you posted.