Using a button to open a report off a specific form's record

vhanus2

Registered User.
Local time
Today, 01:59
Joined
Aug 13, 2018
Messages
10
Hello,

Im currently trying to create a button on a form that would open the record in a report, and one that would eventually print said record.

I currently have the button working; however, its asking for a parameter.

if any one has any suggestions it would be helpful.

My current macro for this is:

OpenReport
Report Name rptCB-S
View Print Preview
Filter Name
Where Conditon =[CB(S)ID]=[Forms]![fmCB-S]![CB(S)ID]
Window Mode Normal
 
The parameter prompt is Access telling you it can't find something, so double check the spelling. I don't use macros, so not sure of the exact syntax required. It would look like this in VBA:

http://www.baldyweb.com/wherecondition.htm
 
Paul,

I've tried using the VBA, and it is coming back with a Invalid Outside Procedure error.

This is the code:
Code:
Private Sub Command465_Click()
DoCmd.OpenReport "rptCB-S", acViewPreview, , "[CB(S)ID]=" & Me.[CB(S)ID]

End Sub
 
There must be more. What's the entire module's code? If you hit Debug/Compile..., what line is highlighted?
 
There is no option for Debug/compile--this is the error:
the expression after update you entered as the event property setting produced the following error: invalid outside procedure.
the expression may not result in the name of the macro, the name of a user-defined function, or [event procedure]
there may habe been an error evaluating the function, event, or macro.
 
I meant to do that before testing. It sounds like there's code someplace else causing the error, as that looks okay to me. Can you attach the db here?
 
You've got a stray End Sub above this sub that needs to be deleted:

Code:
Option Compare Database

[COLOR="Red"]End Sub[/COLOR]

Private Sub Command465_Click()
DoCmd.OpenReport "rptCB-S", acViewPreview, , "[CB(S)ID]=" & Me.[CB(S)ID]

End Sub

Also:

http://www.baldyweb.com/OptionExplicit.htm
 
Happy to help and welcome to the site by the way!
 

Users who are viewing this thread

Back
Top Bottom