PC Review


Reply
Thread Tools Rate Thread

Conditional VBA

 
 
SJW_OST
Guest
Posts: n/a
 
      28th Oct 2008
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
 
Reply With Quote
 
 
 
 
Scott Lichtenberg
Guest
Posts: n/a
 
      28th Oct 2008

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

"SJW_OST" <(E-Mail Removed)> wrote in message
news:F31AC466-542C-4B92-AD61-(E-Mail Removed)...
>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


 
Reply With Quote
 
SJW_OST
Guest
Posts: n/a
 
      28th Oct 2008
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?


"Scott Lichtenberg" wrote:

>
> 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
>
> "SJW_OST" <(E-Mail Removed)> wrote in message
> news:F31AC466-542C-4B92-AD61-(E-Mail Removed)...
> >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

>
>

 
Reply With Quote
 
SJW_OST
Guest
Posts: n/a
 
      28th Oct 2008
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!

"SJW_OST" wrote:

> 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?
>
>
> "Scott Lichtenberg" wrote:
>
> >
> > 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
> >
> > "SJW_OST" <(E-Mail Removed)> wrote in message
> > news:F31AC466-542C-4B92-AD61-(E-Mail Removed)...
> > >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

> >
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to apply a conditional Select distinct (or conditional Where onduplicated cell values in a column) Jamie Microsoft Access Queries 3 2nd Oct 2009 07:39 PM
Conditional Formatting No Longer Conditional in 2007 Beta =?Utf-8?B?Q2FjdHVhci1Oby1KdXRzdQ==?= Microsoft Excel Crashes 0 17th Nov 2006 10:01 PM
Using query results within Conditional Statement...sequenced conditional queries rafael.farias.jr@gmail.com Microsoft Access 3 30th Aug 2006 02:08 PM
Conditional Formatting that will display conditional data =?Utf-8?B?QnJhaW5GYXJ0?= Microsoft Excel Worksheet Functions 1 13th Sep 2005 05:45 PM
Re: Multiple conditional on conditional format formula Bob Phillips Microsoft Excel Programming 0 27th Jul 2004 05:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:01 PM.