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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
Syntax Where Condition in Macro
|
#4
|
|||
|
|||
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 | |
|
|