Problem with OpenReport action

Timberwolf

Registered User.
Local time
Today, 20:52
Joined
Dec 15, 2000
Messages
33
I've created an OpenReport action in a macro, which I want to use to print a report for only the current record in a form. My where condition for the action is:
[ClaimantID]=[Forms]![ClaimantsInput]![ClaimantID]

But when I click the button in the report, I get an "Enter Parameter Value" window asking for Forms!ClaimantsInput!ClaimantID. So I manually type in the ClaimantID for the current record in the form, and the report prints.

There are no other actions in the macro.

What am I doing wrong? Thanks.
 
Hi Timberwolf

Better to use coding for this rather than a Macro.

-------------------------------------------
Sub cmdClaimantReport_Click():
On Error GoTo Err_cmdClaimantReport_Click

Dim strDocName As String
Dim strLinkCriteria As String

strDocName = "rptClaimantReport"
strLinkCriteria = "[ClaimantID] = Forms![frmClaimantInput]![ClaimantID]"
DoCmd.OpenReport strDocName, acPreview, , strLinkCriteria

Exit_cmdClaimantReport_Click:
Exit Sub

Err_cmdClaimantReport_Click:
MsgBox Err.Description
Resume Exit_cmdClaimantReport_Click

End Sub
------------------------------------------

If you still get a parameter problem check the query that the report is based upon.

HTH

Rich Gorvin
 

Users who are viewing this thread

Back
Top Bottom