Controlling Printing with Command Button

sldghmr

New member
Local time
Today, 02:11
Joined
Apr 23, 2009
Messages
2
I have a form with a 'Print' command button and another button called 'Save and New'. The way the form is used is as follows:

1. Data is entered into the form.
2. Form is printed with the 'Print' button.
3. The data is written and advanced to the next record with the 'Save and New' button.
4. Next round of data is entered and the process is repeated.

The issue I have is that when the 'Print' button is pressed to print the second round of data, I get the 1st data entered AND the second. If the process is repeated again, I get 3 items printed out.

Command button:
Private Sub bPrintForm_Click()

On Error GoTo Err_Print_Click
DoCmd.RunCommand acCmdPrint
Exit_bPrintForm_Click:
Exit Sub

Err_Print_Click:

MsgBox Err.Description
MsgBox "You MUST enter all required Data Highlighted in Yellow"
Resume Exit_bPrintForm_Click

End Sub

Save and New button:

Private Sub bSave_n_New_Click()
On Error GoTo Err_bSave_n_New_Click


DoCmd.GoToRecord , , acNext

Exit_bSave_n_New_Click:
Exit Sub

Err_bSave_n_New_Click:
MsgBox Err.Description
MsgBox "You MUST enter all required Data Highlighted in Yellow"
Resume Exit_bSave_n_New_Click

End Sub

Thanks for any help and suggestions.
 
Forms aren't designed with printing in mind you should use Reports instead
 
I understand that, especially after several hours of googling. However, I found an easy way to control this via the printer dialogue box. All one needs to do is select "Selected Records" instead of "All".

I'd have rather found resolution through coding, but for my needs on this project, the workaround is sufficient.

Thanks for the response.
 

Users who are viewing this thread

Back
Top Bottom