Report from subform help

J

Joe Cilinceon

Here is what I have:

On a subform (Datasheet type) when I select a row I would like it to than
allow me to print a receipt. I've added a command button with the following
code:

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 = "[Transaction] = " & Me.[Transaction]
DoCmd.OpenReport "Payment Receipt", acViewPreview, , strWhere
End If

Once I hit the button I get a Runtime Error 2465 and "Can't find the Field
'|' Referred to in your field.

Any help would be greatly appreaciated
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Opening report 4
Print the record in the form 1
Printing Report 3
HELP with Print Current Record 2
Command button to open report 1
Search Form with a SubForm 3
If, Then Button Code 1
Subform Search Function 2

Top