M
microsoft
DisplayRecord is used in a form to display detail information for a record.
The Form_AfterUpdate code is used to refresh the records so that any updates
are visible to the user. On my personal machine, the code works and the
records are refreshed, however on my development machine at work, the code
fails. I have confirmed that the global variable gCallingForm is being
correctly updated and that the form is loaded. The .Refresh statement does
not throw an error.
Private Sub DisplayRecord()
On Error GoTo Err_DisplayRecord
gCallingForm = "frmTrailerInventoryMaintenance"
MsgBox gCallingForm
DoCmd.OpenForm "frmTrailerInventoryMasterRecord", , ,
"[txtTrailerDOTNumber] =
[Forms]![frmTrailerInventoryMaintenance]![txtTrailerDOTNumber]"
Exit_DisplayRecord:
Exit Sub
Err_DisplayRecord:
MsgBox getDefaultErrorMessage(Me.Name, "DisplayRecord", Err.Number,
Err.Description), vbCritical
Resume Exit_DisplayRecord
End Sub
Private Sub Form_AfterUpdate()
On Error GoTo Err_Form_AfterUpdate
MsgBox gCallingForm & " " & isLoaded(gCallingForm)
If isLoaded(gCallingForm) Then Forms(gCallingForm).Refresh
Call lockFields
Exit_Form_AfterUpdate:
Exit Sub
Err_Form_AfterUpdate:
MsgBox getDefaultErrorMessage(Me.Name, "Form_AfterUpdate", Err.Number,
Err.Description), vbCritical
Resume Exit_Form_AfterUpdate
End Sub
The Form_AfterUpdate code is used to refresh the records so that any updates
are visible to the user. On my personal machine, the code works and the
records are refreshed, however on my development machine at work, the code
fails. I have confirmed that the global variable gCallingForm is being
correctly updated and that the form is loaded. The .Refresh statement does
not throw an error.
Private Sub DisplayRecord()
On Error GoTo Err_DisplayRecord
gCallingForm = "frmTrailerInventoryMaintenance"
MsgBox gCallingForm
DoCmd.OpenForm "frmTrailerInventoryMasterRecord", , ,
"[txtTrailerDOTNumber] =
[Forms]![frmTrailerInventoryMaintenance]![txtTrailerDOTNumber]"
Exit_DisplayRecord:
Exit Sub
Err_DisplayRecord:
MsgBox getDefaultErrorMessage(Me.Name, "DisplayRecord", Err.Number,
Err.Description), vbCritical
Resume Exit_DisplayRecord
End Sub
Private Sub Form_AfterUpdate()
On Error GoTo Err_Form_AfterUpdate
MsgBox gCallingForm & " " & isLoaded(gCallingForm)
If isLoaded(gCallingForm) Then Forms(gCallingForm).Refresh
Call lockFields
Exit_Form_AfterUpdate:
Exit Sub
Err_Form_AfterUpdate:
MsgBox getDefaultErrorMessage(Me.Name, "Form_AfterUpdate", Err.Number,
Err.Description), vbCritical
Resume Exit_Form_AfterUpdate
End Sub