Macro condition syntax

AlenM

AlenM
Local time
Today, 16:51
Joined
Mar 21, 2010
Messages
2
I can't seem to find a simple guide to syntax in the conditions area of an access macro. I want a msg box to appear if a date which falls on a Sunday is entered into the date field. (Sundays are valid days for our purposes, just unusual so I want the user to check they've got the date right, rather than prevent the date). The date field has data in the format e.g. Sunday, 21 March 2010 and I can't seem to find a way of expressing the condition 'if the date field contains the word 'Sunday' whatever else it may contain.

I'm not very experienced with macros or VBA but I think that I understand the concepts reasonably well.
 
Open design view of the original table (Not report) then add a validation rule on that field.
 
Thanks for this suggestion, but i can't see how it will help. Every day is a valid input for this feel; Sunday's are unusual, not invalid, and I simply want an alert when the user enters a date that is a Sunday on the inputing.

I'd be grateful for a pointer to a general guide on the syntax for conditions in embedded macros.
 
Basically (if it is a date field) something like WeekDay(yourdate) = 1
If it was a string then something like this Instr(1,YouValueToCheck,"Sunday")
The macro condition is sort of like the IIF without the then and else and the word IIF.
Then means run the command, else means bypass this command.
 

Users who are viewing this thread

Back
Top Bottom