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 gkittelson 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 Only - Non Query Based Report

Status
Not open for further replies.

number2

Technical User
Oct 25, 2001
284
US
I am really having a tough time. I need to find a way to print only the current records feilds for address labels.

I have a large data form which has feilds for various contacts. Sometimes several records will have the same contacts. I thought I had this solved with the code below, but it prints out a label for EACH incident that the contact is in the database (if the attorney is in the database on 4 occaisions, I get 4 labels)

Unfortunately my label forms are not query based so I used the code below. Can anyone help me through this.

Private Sub Label370_Click()
On Error GoTo Err_Label370_Click
Dim strCriteria As String
strCriteria = "[QME/AME Information]![attorney]=[Forms]![QME/AME Information]![attorney]"

DoCmd.OpenReport "attorney Label", acViewPreview, , strCriteria


Exit_Label370_Click:
Exit Sub

Err_Label370_Click:
MsgBox Err.Description
Resume Exit_Label370_Click
DoCmd.Close
End Sub
 
Yes. I get identical copies for each incident in which the contact shows in the recordset. Is there a way to limit to print one only?
 
You need more criteria in your strCriteria string. What is the primary key for this table? If you only want 1 label pass that field as your criteria instead of the attorney field. Maq B-)
<insert witty signature here>
 
How do I add the extra criteria? Can I also use the some criteris in a query?

Unfortunately I may need to strip the labeling vapabilities out of this version, as I can not find a way to handle printer setup in Access Runtime; it can not save page setup options. Therefore the user would have to set up the page options every time they want to print a label. Not an effective use of time!
 
Number 2

I may be way off the mark here but have you tried using a group query for the data source for the label report. Its a quick fix I have used in the past where there are duplicate records on a report if the data is the same on all the records in your record set then using a group will elimiate this duplicate.

Of course I may be way of the mark here.

Hope that helps
 
Num2,

It sounds like you want to print a single label for the record that is on your form. If that's the case then you need to first determine what makes that record unique from the other records in the table. (The primary key). Since you said multiple records exist with the same attorney then obviously the attorney is not the primary key.

The code you posted above is correct, you just need to replace the attorney field in your criteria with the primary key field. Maq B-)
<insert witty signature here>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top