Getting a report to print one record instead of all of them

Dscalf1

Registered User.
Local time
Yesterday, 16:29
Joined
Jul 17, 2015
Messages
33
Hey guys!

I am trying to get a report to print out one one record that I want.. I feel like this should be easier than it seeming to be..

I want it to be able to be sorted by date and the user just picks a date and one record is printed out on page. Right now every record that is stored is being printed on a different page and over time that is going to be a lot of paper... I want to be able to pick which record I want printed...


The Form is called "Bread Mold"
The report is called "Bread Mold Report"
The table is called "Bread Mold"
What it is sorted by is called "Swab Date"

I could really use some help on this im not sure how to do it.
 
I have tried that code idk if i am putting it in the wrong place or what but it isnt working for me.
 
I have no idea what "isn't working for me" means. What is your exact code? Where exactly is it?
 
I have no idea what "isn't working for me" means. What is your exact code? Where exactly is it?

Here is the code:

Private Sub Command317_Click()
DoCmd.OpenReport "Bread Mold Report", , , "Swab Date = #" & Me.Text307 & "#"
End Sub

And I have it in a button on the form. When the user clicks the button a pop up comes up asks for the date and then still prints all the records.
 
Because of the inadvisable space try:

DoCmd.OpenReport "Bread Mold Report", , , "[Swab Date] = #" & Me.Text307 & "#"
 
I changed it and it is still printing all the records idk why... should i have parameters on the report or something. I tried a different coding way and it did the same thing.. this is what else i have tried but it would print all the records as well

Private Sub Command317_Click()
On Error GoTo Err_Command317_Click
Dim strDocName As String
Dim strLinkCriteria As String

strDocName = "Bread Mold Report"
strLinkCriteria = "[Swab Date] = Forms![Bread Mold]![Text307]"

DoCmd.OpenReport strDocName, acNormal, , strLinkCriteria

Exit_Command317_Click:
Exit Sub

Err_Command317_Click:
MsgBox Err.Description
Resume Exit_Comman317_Click

End Sub
 
Did you try what I posted? Can you post the db here?
 
I did try what you had posted and it still prints both records... Is there anyway I can privately send you the database?
 
You can email it to

pbaldy
gmail
com
 
Thank you that was it... Such a simple mistake :banghead: .. Thank you for looking at it for me.

And I will take a look at that article!
 

Users who are viewing this thread

Back
Top Bottom