Full Version: One Form Two Print Buttons in Access 2007
UtterAccess Forums > Microsoft® Access > Access Forms
LATConfSvcs
Please help. I have a form for my small convention registration business that I have a print button setup for to print one record at a time as attendees walk up or need to change their badge. For my next convention, the meeting planner has asked for a double sided name badge. I'll need the attendees information for the back side as her boss doesn't like the bar code on the front so I'm going to print the name on one badge and the bar code on another and place them back to back in the holder. I need help setting up the 2nd print command button for the printing of the bar code. Here's what I have so far that works for the front. I just need to know what to add to get my 2nd print button to work using a separate report. Many, many thanks!
ommand 33 is the print button I currently have setup and works. The 2nd print button is command 68.
---------------------------------------------------------
Private Sub Command33_Click()
Dim strReportName As String
Dim strCriteria As String

strReportName = "rptPrintRecord"
strCriteria = "[ID 2]=" & Me![ID 2]
DoCmd.OpenReport strReportName, acViewPreview, , strCriteria
End Sub
Private Sub Command35_Click()
On Error GoTo Err_Command35_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_Command35_Click:
Exit Sub
Err_Command35_Click:
MsgBox Err.Description
Resume Exit_Command35_Click

End Sub
Private Sub Command68_Click()
End Sub
Private Sub Save_Click()
On Error GoTo Err_Save_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Exit_Save_Click:
Exit Sub
Err_Save_Click:
MsgBox Err.Description
Resume Exit_Save_Click

End Sub
argeedblu
I am not sure if you problem is simply modifying the code or if it might be how to print bar codes. If you already have the barcode report, then just copy the code from the Command33_Click sub to the Command68_Click sub and modify the text in the strReportName = "rptPrintRecord"
statement to the name of your barcode report.
Glenn
LATConfSvcs
That's what the rookie in me thought. I tried that before posting and all it does is print three record from the form and not from the report I created. I wasn't sure if I was to add the code to the beginning or end of the existing code. I tried both and got the same results. What am I missing?
argeedblu
Can you zip and attach a copy of your database. If I can see what you are seeing, that might help me decipher the problem.
Glenn
LATConfSvcs
The file is too big zipped to send via UA. May I email it to you?
niesz
As an alternative, have you considered printing "fold-over" cards? Print a card twice as big with both on one side and simply fold it in half?
argeedblu
Just create a new database and import from your original. Set the import options for tables to structure only. That should make it small enough to zip and attach
Glenn
LATConfSvcs
That's a good suggestion, I hadn't thought of that....thanks!!!
LATConfSvcs
Let's see if this one goes through...
niesz
NP. thumbup.gif
If you still want to find out the original solution, I'm sure Glenn can take you through the process. wink.gif
LATConfSvcs
You have no clue how much I appreciate your help on this. I've been racking my rookie brain to try to figure this out. I'm looking forward to seeing if Glenn can figure it out.
LATConfSvcs
You have no clue how much I appreciate your help on this. I've been racking my rookie brain to try to figure this out. I'm looking forward to seeing if Glenn can figure it out.
LATConfSvcs
Larry, did you get the download?
niesz
Who's Larry? wary.gif
LATConfSvcs
Oops...I meant Glenn....sorry!
argeedblu
I'm looking at the db now. The copy you uploaded doesn't have any reports. I will need to see the report designs to try to track down the problem. There is also data in the one table. When you do the import make sure to set the option to structure only. If the data is data let me know so that i can delete the attachment.
Glenn
LATConfSvcs
Glenn:
It's not giving me the option to import structure only when doing the import. I'm working with Access 07. Where do I find this "structure" only feature?
Jeff
argeedblu
See the attached. On the import objects dialogue, click the options button and select "definitions only" for tables.
Glenn
LATConfSvcs
I think I got it this time, thank you for your patience and understanding.
argeedblu
It looks like you managed the upload without data ok. I'l have a look at things now.
Glenn
argeedblu
I made the change I suggested earlier:
CODE
Private Sub Command68_Click()
   Dim strReportName As String
   Dim strCriteria As String
    
   strReportName = "rptPrintRecord2"
   strCriteria = "[ID]=" & Me![ID]
   DoCmd.OpenReport strReportName, acViewPreview, , strCriteria
And Sub
and the results I am getting are attached.
The results seem to be what I understand as your requirement.
I am not sure what you mean by this com
HAs for this part: there is a section of your code that begins with Private sub command68_click and ends with end sub. That's where the code goes.
Glenn
LATConfSvcs
Glenn:
Can you attach the database with code so I can see it in it's entirety?
Thank you
Thank you
Thank you
Jeff O.
argeedblu
Sure can. As you may have noticed that I populated the table with some random (therefore meaningless) data.
ncidentally, there are some problems with the structure of your database. These may seem like picky issues but as you continue to use the application their significance and impact on performance and stability will grow to unmanageable proportions.
One issue is the calculated field 'last name.' You should not be storing this value. When you need it you can construct the value on a form or report or in a query using concatenation. Another issue is the use of spaces in some field names. You should avoid spaces in field, control, and object names.
You may want to consider having address informaition in a separate table. That way you can have multiple addresses for the same person. The company and company1 fields really should be records in a related table rather than having two columns.
In general, I suggest that you read up on relational database design. There are a number of relevant articles here. Some links you might find helpful are these:

For more in depth reading you could check out this page.
Glenn
LATConfSvcs
This is very helpful information. I don't see an attachment though.
argeedblu
Look at the top of the message in the line immediately below the subject line. There is a link to the attachment there.
Glenn
LATConfSvcs
That's strange, I see it there now but didn't see it earlier.
Thanks!
LATConfSvcs
It was Network access was interruppted, please close and try again. I tried again but keep getting the same message.
argeedblu
The link works so I am not sure why you are having difficulty downloading it. Perhaps try disconnecting from you IP and reconnecting and then try the download again.
Glenn
LATConfSvcs
Glenn:
copied the code that you provided into my database and it works. What a sigh of relief, thank you ever so much.
Jeff J. Olszewski
argeedblu
You are welcome, Jeff!
Glenn
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.