Conditional VBA

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
 
S

Scott Lichtenberg

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
 
S

SJW_OST

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?
 
S

SJW_OST

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!
 

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