Need button on Access 2013 form to print report with current record

Hi, I am new to Access but have managed to create a simple single table database, form and report.  One of my issues is how do I make this desktop database user friendly for users?  No one knows how to use Access here so will they have to go into access development area like I do and enter data?  Or is there a way to have the form show up in a GUI data entry environment?  The problem I have relating directly to the title is how do I program/code a command button to run a report I have created and only print the current record on the screen?  The report is called JobTicket and the form is called Job# Form.  I am able to create a button and use the wizard to print the JobTicket report but it always prints ALL the records, not just the current one.  Thank you very much.  Please be specific if answering because I am brand new to this.  Thank you!
mjchevalierAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Eric ShermanAccountant/DeveloperCommented:
Yes you can ... Just base your report off of a query object.  In your table you should have a field that uniquely identifies the current record the pointer is on.  

Then use this code behind your button to print your report.

If the field is Text ...
DoCmd.OpenReport "YourReportName", acViewNormal, , "[YourFieldName] = '" & Me.FieldName & "'"

If the field is a number ...
DoCmd.OpenReport "YourReportName", acViewNormal, , "[YourFieldName] ="  & Me.FieldName


ET
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jeffrey CoachmanMIS LiasonCommented:
<No Points wanted>

You should also save the current record first (so if any edits were made the changes will be reflected in the report.

DoCmd.RunCommand accmdsaverecord
DoCmd.OpenReport...
...
0
Eric ShermanAccountant/DeveloperCommented:
Or ...

Me.Dirty = False


ET
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

PatHartmanCommented:
To make the database open to a form, use the Access Options dialog.  You get to this dialog different ways depending on the version of Access you are using.
Access Options
0
mjchevalierAuthor Commented:
Thank you all.  etsherman, I already built a report that has everything formatted correctly, so I am not sure what to do when you say, "just base your report off of a query object."  I don't know where to put the code that you gave me behind the button.  Can you please explain in complete novice details?  Thank you so much!
0
Eric ShermanAccountant/DeveloperCommented:
<<<<<Thank you all.  etsherman, I already built a report that has everything formatted correctly, so I am not sure what to do when you say, "just base your report off of a query object."  I don't know where to put the code that you gave me behind the button.  Can you please explain in complete novice details?  Thank you so much! >>>>>

Change the Record Source of your report from your Table Object to a Query Object.  A Query will give you more flexibility when creating reports and forms like creating additional calculated fields and adding WHERE Clauses, etc.  Create a Select query named qryYourReportName and select the fields from your table.  Save it and use that for the Record Source ... not the table.  The code goes behind the button you are using to run the report.   How are you running the report???

Can you load up a sample database???  That would make things easier to explain once you see it.

ET
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.