Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print current record from a form

Status
Not open for further replies.

selavarti

Programmer
Feb 24, 2004
33
0
0
US
Hi,

In my form I am checking out a tool with employeee Id and date. I want to print that particular record on the form. Just like reciept. I used the print record wizard button, but its not printing anything. Its giving out blank paper. Can any one figure it out for me. I would really appreciate it.

Thanks
 
Selevarti
There may be other ways to do what you want, but here's one. Change what I show as RecordID if that isn't what you use to identify individual records.

1. Create a report based on a query.
2. In the RecordID column in the query, put the criteria
Forms!YourFormName!RecordID
3. On your form, create a command button that opens the report, which will then print the record you have selected.

Here is an example of code for the command button...
Private Sub cmdPrintSelect_Click()
On Error GoTo Err_cmdPrintSelect_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Dim stDocName As String

stDocName = "rptPrintSelect"
DoCmd.OpenReport stDocName, acPreview

Exit_cmdPrintSelect_Click:
Exit Sub

Err_cmdPrintSelect_Click:
MsgBox Err.Description
Resume Exit_cmdPrintSelect_Click

End Sub

The code I showed here begins by saving the record. That is in case you are working with a new record that hasn't yet been saved and you want to print it (unless you save the record first it won't print it).

Hope that helps.

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top