Go Back   Access World Forums > Microsoft Access Discussion > Reports

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 08-13-2018, 07:47 AM   #1
vhanus2
Newly Registered User
 
Join Date: Aug 2018
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
vhanus2 is on a distinguished road
Using a button to open a report off a specific form's record

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

vhanus2 is offline   Reply With Quote
Old 08-13-2018, 08:12 AM   #2
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 31,841
Thanks: 9
Thanked 3,824 Times in 3,767 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: Using a button to open a report off a specific form's record

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
Microsoft Access MVP

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
Old 08-13-2018, 08:30 AM   #3
vhanus2
Newly Registered User
 
Join Date: Aug 2018
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
vhanus2 is on a distinguished road
Re: Using a button to open a report off a specific form's record

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

vhanus2 is offline   Reply With Quote
Old 08-13-2018, 08:32 AM   #4
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 31,841
Thanks: 9
Thanked 3,824 Times in 3,767 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: Using a button to open a report off a specific form's record

There must be more. What's the entire module's code? If you hit Debug/Compile..., what line is highlighted?
__________________
Paul
Microsoft Access MVP

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
Old 08-13-2018, 09:31 AM   #5
vhanus2
Newly Registered User
 
Join Date: Aug 2018
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
vhanus2 is on a distinguished road
Re: Using a button to open a report off a specific form's record

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.
vhanus2 is offline   Reply With Quote
Old 08-13-2018, 09:36 AM   #6
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 31,841
Thanks: 9
Thanked 3,824 Times in 3,767 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: Using a button to open a report off a specific form's record

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?
__________________
Paul
Microsoft Access MVP

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
Old 08-13-2018, 09:42 AM   #7
vhanus2
Newly Registered User
 
Join Date: Aug 2018
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
vhanus2 is on a distinguished road
Re: Using a button to open a report off a specific form's record

Here you go.
Attached Files
File Type: accdb DBCOPY.accdb (1.72 MB, 16 views)

vhanus2 is offline   Reply With Quote
Old 08-13-2018, 09:45 AM   #8
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 31,841
Thanks: 9
Thanked 3,824 Times in 3,767 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: Using a button to open a report off a specific form's record

You've got a stray End Sub above this sub that needs to be deleted:

Code:
Option Compare Database

End Sub

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
__________________
Paul
Microsoft Access MVP

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
The Following User Says Thank You to pbaldy For This Useful Post:
vhanus2 (08-13-2018)
Old 08-13-2018, 09:48 AM   #9
vhanus2
Newly Registered User
 
Join Date: Aug 2018
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
vhanus2 is on a distinguished road
Re: Using a button to open a report off a specific form's record

Thank you!! It worked.
vhanus2 is offline   Reply With Quote
Old 08-13-2018, 09:51 AM   #10
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 31,841
Thanks: 9
Thanked 3,824 Times in 3,767 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: Using a button to open a report off a specific form's record

Happy to help and welcome to the site by the way!

__________________
Paul
Microsoft Access MVP

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
Reply

Tags
form button , report designer

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Button to open form to specific record not working... Oimoi Forms 3 04-24-2012 03:50 PM
Button to open form to a specific record. Richard66 Modules & VBA 2 07-27-2010 01:31 PM
Continuous form Button to Open Specific Record fractals Forms 4 06-08-2009 07:34 AM
Continuous form Button to Open Specific Record fractals Forms 1 06-07-2009 07:28 PM
Command button to open form at a specific record peted Forms 7 06-11-2008 01:44 AM




All times are GMT -8. The time now is 03:02 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World