Where Condition

  • Thread starter Thread starter David
  • Start date Start date
D

David

Hello,

Can someone please show me the correct syntax for a
DoCmd.OpenReport?

Here is what I have;
DoCmd.OpenReport "Box Request", acViewNormal, ,
[control_no]=Forms![frmBoxRequest]![cboControl_No].

Also, because my where condition may be based off of
several values, I will be using a string in the where
condition parameter. Is this allowed and is there any
limit to how many "conditions" I can use?

Thanks,
David
 
David said:
Can someone please show me the correct syntax for a
DoCmd.OpenReport?

Here is what I have;
DoCmd.OpenReport "Box Request", acViewNormal, ,
[control_no]=Forms![frmBoxRequest]![cboControl_No].

Also, because my where condition may be based off of
several values, I will be using a string in the where
condition parameter. Is this allowed and is there any
limit to how many "conditions" I can use?


WhereCondition is itself a string argument. This means it
must be enclosed in quotes and any quotes in the argument
will be nested quotes. In addition, any values you want to
put into the argument need to be concatenated.

You can have up to 40 conditional expressions separated by
"And" in a where clause.

DoCmd.OpenReport "Box Request", acViewNormal, , _
"[control_no]=" & Me![cboControl_No] _
& " AND [textfield] = """ & Me.textbox & """"
 
Thank you so much Marsh! That is exactly what I needed to
know and was having trouble finding a descent example.

David
-----Original Message-----
David said:
Can someone please show me the correct syntax for a
DoCmd.OpenReport?

Here is what I have;
DoCmd.OpenReport "Box Request", acViewNormal, ,
[control_no]=Forms![frmBoxRequest]![cboControl_No].

Also, because my where condition may be based off of
several values, I will be using a string in the where
condition parameter. Is this allowed and is there any
limit to how many "conditions" I can use?


WhereCondition is itself a string argument. This means it
must be enclosed in quotes and any quotes in the argument
will be nested quotes. In addition, any values you want to
put into the argument need to be concatenated.

You can have up to 40 conditional expressions separated by
"And" in a where clause.

DoCmd.OpenReport "Box Request", acViewNormal, , _
"[control_no]=" & Me![cboControl_No] _
& " AND [textfield] = """ & Me.textbox & """"
 
Thank you so much Marsh! That is exactly what I needed to
know and was having trouble finding a descent example.

David
-----Original Message-----
David said:
Can someone please show me the correct syntax for a
DoCmd.OpenReport?

Here is what I have;
DoCmd.OpenReport "Box Request", acViewNormal, ,
[control_no]=Forms![frmBoxRequest]![cboControl_No].

Also, because my where condition may be based off of
several values, I will be using a string in the where
condition parameter. Is this allowed and is there any
limit to how many "conditions" I can use?


WhereCondition is itself a string argument. This means it
must be enclosed in quotes and any quotes in the argument
will be nested quotes. In addition, any values you want to
put into the argument need to be concatenated.

You can have up to 40 conditional expressions separated by
"And" in a where clause.

DoCmd.OpenReport "Box Request", acViewNormal, , _
"[control_no]=" & Me![cboControl_No] _
& " AND [textfield] = """ & Me.textbox & """"

You can find your examples in Access Help.
Restrict + Restrict data to a subset of records.
Then click on the links for the various datatypes,
 
Back
Top