Cannot select "selected record"

W

Woody

When I select to print a record in MS Access 97
the "selected record" box is not accessable. Is this a
windows problem or an access problem. I need help to fix.
I am using an HP deskjet 1220c.
 
A

Allen Browne

For print outs, design a report that lays out the data the way you want.
To get a report similar to your form, use File | Save As.

Now add a command button to your form for "Print this record."

Set the On Click property of the command button to:
[Event Procedure]

Click the build button (...) beside this.
Access opens the Code window.

Between the "Private Sub..." and "End Sub" lines, paste this:
Dim strWhere As String
If Me.Dirty Then 'Save any changes.
Me.Dirty = False
End If
If Me.NewRecord Then
MsgBox "Select a record to print"
Else
strWhere = "[ID] = " & Me.[ID]
DoCmd.OpenReport "MyReport", acViewPreview, , strWhere
End If


Note: this assumes you have an AutoNumber primary key named "ID".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top