N
Nick C
I have created an MSAccess 2000 form that allows users to print the last
record entered and add a new record. This is the code for the print button:
Private Sub cmdPrintCert_Click()
On Error GoTo ErrLast
DoCmd.RunCommand acCmdRecordsGoToLast
Dim stReportName As String
Dim stCriteria As String
stReportName = "rptCofC"
stCriteria = "[ID] = " & Me![ID] & ""
DoCmd.OpenReport stReportName, acPrint, , stCriteria
DoCmd.GoToRecord , , acNewRec
Exit Sub
ErrLast:
Select Case Err
Case 2046
'Command not available
MsgBox "You are already on the last record.", vbInformation, "Not
Available"
Case Else
MsgBox Err.Number & ":-" & vbCrLf & Err.Description
End Select
End Sub
The problem I am having is as follows: there are fields in the text and
combo boxes that need to be retained from the previous record since a lot of
the data entry is repetitive. I created an event procedure for the text
boxes that need to retain data from the last record entered as follows:
Private Sub Descr_AfterUpdate()
Me.ActiveControl.DefaultValue = "'" & Me.ActiveControl & "'"
End Sub
However, the Print button overrides this code and upon printing, the fields
are once again blank. I really need to get this to work; it would save our
users a LOT of time. Any help here would be GREATLY appreciated.
Thanks in advance,
Nick
record entered and add a new record. This is the code for the print button:
Private Sub cmdPrintCert_Click()
On Error GoTo ErrLast
DoCmd.RunCommand acCmdRecordsGoToLast
Dim stReportName As String
Dim stCriteria As String
stReportName = "rptCofC"
stCriteria = "[ID] = " & Me![ID] & ""
DoCmd.OpenReport stReportName, acPrint, , stCriteria
DoCmd.GoToRecord , , acNewRec
Exit Sub
ErrLast:
Select Case Err
Case 2046
'Command not available
MsgBox "You are already on the last record.", vbInformation, "Not
Available"
Case Else
MsgBox Err.Number & ":-" & vbCrLf & Err.Description
End Select
End Sub
The problem I am having is as follows: there are fields in the text and
combo boxes that need to be retained from the previous record since a lot of
the data entry is repetitive. I created an event procedure for the text
boxes that need to retain data from the last record entered as follows:
Private Sub Descr_AfterUpdate()
Me.ActiveControl.DefaultValue = "'" & Me.ActiveControl & "'"
End Sub
However, the Print button overrides this code and upon printing, the fields
are once again blank. I really need to get this to work; it would save our
users a LOT of time. Any help here would be GREATLY appreciated.
Thanks in advance,
Nick