C
charles.kendricks
I am trying to write write a procedure for a button which will open a
report using the value of a field in the open form as the Where
parameter for DoCmd.Openreport. The value of the field is assigned to
a variable defined as an Integer, and the field to which I am assigning
the variable is an Autonumber field. But when I press the button I get
a message box prompting me for the value of the variable. What am I
doing wrong??? Code included below:
Private Sub Command45_Click()
Dim OrderNum As Integer
OrderNum = Forms!frmClientData!frmOrderSubform!OrderNo.Value
'Debug.Print OrderNum
DoCmd.OpenReport "rptReceipt", acViewPreview, ,
"[OrderNo]=OrderNum"
On Error GoTo Err_Command45_Click
Exit_Command45_Click:
Exit Sub
report using the value of a field in the open form as the Where
parameter for DoCmd.Openreport. The value of the field is assigned to
a variable defined as an Integer, and the field to which I am assigning
the variable is an Autonumber field. But when I press the button I get
a message box prompting me for the value of the variable. What am I
doing wrong??? Code included below:
Private Sub Command45_Click()
Dim OrderNum As Integer
OrderNum = Forms!frmClientData!frmOrderSubform!OrderNo.Value
'Debug.Print OrderNum
DoCmd.OpenReport "rptReceipt", acViewPreview, ,
"[OrderNo]=OrderNum"
On Error GoTo Err_Command45_Click
Exit_Command45_Click:
Exit Sub