Conditional VBA

  • Thread starter Thread starter SJW_OST
  • Start date Start date
S

SJW_OST

I have a database that uses a simple module DoCmd to print a set of reports.
I have a Query that designates the day of the week based on a date chooen on
a form.

What I want is; if the day in the query equals Sunday, or any other day of
my choosing, I do not want the DoCmd to activate for a particular report. How
can I do this? I have tried everything I can think of.

Any help is greatly appreciated
Stephen
 
Look at the Weekday function. It returns a number representing the day of
the week.

If Weekday(Me!txtDate) = 7
DoCmd.Something
Else
DoCmd.SomethingElse
End If
 
I am getting and error;

Database can't find the field '|' referred to in your expression.

Should (Me!txtDate) be pointing to the query or form?
 
I found my problem. I was not including [Forms] in the path for the code to
follow. with that change it works like a charm.

Thank you very much!
 
Back
Top