A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Syntax Where Condition in Macro



 
 
Thread Tools Display Modes
  #1  
Old February 13th, 2009, 12:50 AM posted to microsoft.public.access.gettingstarted
jackg
external usenet poster
 
Posts: 9
Default Syntax Where Condition in Macro

I have a report based on a query. The query has a criteria set ('Program'
field from 'Client' Table needs to select records with crieteria of
"highroad" Or "Aftercare". The query runs fine alone and picks records from
'Client' where the 'Program' field contains "highroad" Or "Aftercare". The
report runs fine. When I call the report from a macro (OpenReport) I am
being prompted for the parameters for the 'Program' field?

What do I need to do. If the answer is set the With Condition on the
OpenReport macro, what is the syntax and do I remove the criteria from the
query? Table = Client, Field=Program, Values "Highroad" Or "Aftercare"
Query=Query-AllClients, Report = Report-AllClients. Please help, I have
tired everything I know and nothing is working. What is the syntax for an
expression in the With Condition of an OpenReport Macro.
I am using Access 2003.

Thank You,

Jack G.
  #2  
Old February 13th, 2009, 02:30 PM posted to microsoft.public.access.gettingstarted
stumac
external usenet poster
 
Posts: 165
Default Syntax Where Condition in Macro

Jack, can you post the sql from your query?

Stu

"JackG" wrote:

I have a report based on a query. The query has a criteria set ('Program'
field from 'Client' Table needs to select records with crieteria of
"highroad" Or "Aftercare". The query runs fine alone and picks records from
'Client' where the 'Program' field contains "highroad" Or "Aftercare". The
report runs fine. When I call the report from a macro (OpenReport) I am
being prompted for the parameters for the 'Program' field?

What do I need to do. If the answer is set the With Condition on the
OpenReport macro, what is the syntax and do I remove the criteria from the
query? Table = Client, Field=Program, Values "Highroad" Or "Aftercare"
Query=Query-AllClients, Report = Report-AllClients. Please help, I have
tired everything I know and nothing is working. What is the syntax for an
expression in the With Condition of an OpenReport Macro.
I am using Access 2003.

Thank You,

Jack G.

  #3  
Old February 14th, 2009, 04:40 PM posted to microsoft.public.access.gettingstarted
nik[_4_]
external usenet poster
 
Posts: 1
Default Syntax Where Condition in Macro

Fahsjhdskfhklsdf



On 2/14/09 9:26 AM, in article
,
" wrote:

Jack:

On the information you've provided I can't see why you should be
prompted for parameters when opening the report via a macro. If you
can open the report from the database window, then it should open via
a macro. Odd!

When using the WhereCondition setting of the OpenReport method in
code, or the same action in a macro you don't need the criteria in the
query, so you can delete them. In the macro the expression for the
WhereCondition setting is:

[Program] = "Highroad" Or [Program] = "Aftercare"

BTW if you do the same thing in code the expression would be:

"[Program] = ""Highroad"" Or [Program] = ""Aftercare"""

This is because the WhereCondition is a string expression so needs to
be enclosed in quotes characters. The quotes characters around the
two values consequently need to be doubled up as this is how a literal
quotes character is included in a string already delimited by quotes
characters.

Ken Sheridan
Stafford, England

On Feb 13, 12:50 am, JackG wrote:
I have a report based on a query. The query has a criteria set ('Program'
field from 'Client' Table needs to select records with crieteria of
"highroad" Or "Aftercare". The query runs fine alone and picks records from
'Client' where the 'Program' field contains "highroad" Or "Aftercare". The
report runs fine. When I call the report from a macro (OpenReport) I am
being prompted for the parameters for the 'Program' field?

What do I need to do. If the answer is set the With Condition on the
OpenReport macro, what is the syntax and do I remove the criteria from the
query? Table = Client, Field=Program, Values "Highroad" Or "Aftercare"
Query=Query-AllClients, Report = Report-AllClients. Please help, I have
tired everything I know and nothing is working. What is the syntax for an
expression in the With Condition of an OpenReport Macro.
I am using Access 2003.

Thank You,

Jack G.



  #4  
Old February 14th, 2009, 05:26 PM posted to microsoft.public.access.gettingstarted
[email protected]
external usenet poster
 
Posts: 129
Default Syntax Where Condition in Macro

Jack:

On the information you've provided I can't see why you should be
prompted for parameters when opening the report via a macro. If you
can open the report from the database window, then it should open via
a macro. Odd!

When using the WhereCondition setting of the OpenReport method in
code, or the same action in a macro you don't need the criteria in the
query, so you can delete them. In the macro the expression for the
WhereCondition setting is:

[Program] = "Highroad" Or [Program] = "Aftercare"

BTW if you do the same thing in code the expression would be:

"[Program] = ""Highroad"" Or [Program] = ""Aftercare"""

This is because the WhereCondition is a string expression so needs to
be enclosed in quotes characters. The quotes characters around the
two values consequently need to be doubled up as this is how a literal
quotes character is included in a string already delimited by quotes
characters.

Ken Sheridan
Stafford, England

On Feb 13, 12:50 am, JackG wrote:
I have a report based on a query. The query has a criteria set ('Program'
field from 'Client' Table needs to select records with crieteria of
"highroad" Or "Aftercare". The query runs fine alone and picks records from
'Client' where the 'Program' field contains "highroad" Or "Aftercare". The
report runs fine. When I call the report from a macro (OpenReport) I am
being prompted for the parameters for the 'Program' field?

What do I need to do. If the answer is set the With Condition on the
OpenReport macro, what is the syntax and do I remove the criteria from the
query? Table = Client, Field=Program, Values "Highroad" Or "Aftercare"
Query=Query-AllClients, Report = Report-AllClients. Please help, I have
tired everything I know and nothing is working. What is the syntax for an
expression in the With Condition of an OpenReport Macro.
I am using Access 2003.

Thank You,

Jack G.


 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:44 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.