Hi,
I'm trying to run a report based on the current record. Having looked at Allen Browne's website (wow that guy knows his stuff!), I've created the following:
I'm trying to run a report based on the current record. Having looked at Allen Browne's website (wow that guy knows his stuff!), I've created the following:
Code:
Private Sub cmdCreateFileCheck_Click()
Dim strWhere As String
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[Client Ref]" = " & Me.ClientRef"
DoCmd.OpenReport "rptCombinedProductsFileCheck", acViewPreview, , strWhere = "ClientRef = """ & Me.ClientRef & """"
End If
End Sub [\CODE]
I want to use the current record contained in the field ClientRef to produce the report (using a cmdbutton) but the report is blank when the cmdbutton is clicked.
Can anyone see what I'm doing wrong here?