TonyVelasco
New member
- Local time
- Today, 08:23
- Joined
- Jan 9, 2004
- Messages
- 8
Used to be a programmer many years ago, from 1988-1992. Moved on to I.T., mainly network infrastructure and server and desktop design, engineering, and administration. Security, network backbone, server management, and application help desk are my current strengths.
Now I also am being tasked with programming again, but I am more than a little rusty!!! I have forgotten most of what I once knew.
I am using Access 97 from a programming standpoint for the first time. I have a form for data entry, editing and display. It needs to print a license with some of the form data on it.
For various reasons I chose to use a form for the license rather than a report (limitations in Access 97's report capabilities to handle custom page sizes and watermarks, namely).
As such, I have a button on the main form that print's the license form. The code for that button is below. The problem is that the form I am calling defaults to the first record of the table, rathr than the current record of the main form. I need to have it print the record that is on the main form, and only that record.
Any suggestions?
Private Sub PrintLicense_Click()
On Error GoTo Err_PrintLicense_Click
Dim stDocName As String
Dim MyForm As Form
stDocName = "LicenseForm"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut acSelection
DoCmd.SelectObject acForm, MyForm.Name, False
Exit_PrintLicense_Click:
Exit Sub
Err_PrintLicense_Click:
MsgBox Err.Description
Resume Exit_PrintLicense_Click
End Sub
Now I also am being tasked with programming again, but I am more than a little rusty!!! I have forgotten most of what I once knew.
I am using Access 97 from a programming standpoint for the first time. I have a form for data entry, editing and display. It needs to print a license with some of the form data on it.
For various reasons I chose to use a form for the license rather than a report (limitations in Access 97's report capabilities to handle custom page sizes and watermarks, namely).
As such, I have a button on the main form that print's the license form. The code for that button is below. The problem is that the form I am calling defaults to the first record of the table, rathr than the current record of the main form. I need to have it print the record that is on the main form, and only that record.
Any suggestions?
Private Sub PrintLicense_Click()
On Error GoTo Err_PrintLicense_Click
Dim stDocName As String
Dim MyForm As Form
stDocName = "LicenseForm"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut acSelection
DoCmd.SelectObject acForm, MyForm.Name, False
Exit_PrintLicense_Click:
Exit Sub
Err_PrintLicense_Click:
MsgBox Err.Description
Resume Exit_PrintLicense_Click
End Sub
Last edited: