Hi
I’m attempting to open a form at a certain record where the value of an unbound textbox (txtBarcode) is equal to the primary field (signinID).
All works well until I attempt to modify the OnLoad, OnOpen events etc of the form that I’m finding the record within (ContractorSignoutDetailsForm).
Due to the line:
the OnLoad, OnOpen events etc kick in prematurely resulting in the whole database hanging – is there any practical way of getting around this so that the form dosn't have to be loaded at this stage?
I’m attempting to open a form at a certain record where the value of an unbound textbox (txtBarcode) is equal to the primary field (signinID).
All works well until I attempt to modify the OnLoad, OnOpen events etc of the form that I’m finding the record within (ContractorSignoutDetailsForm).
Due to the line:
Code:
DoCmd.OpenForm "ContractorSignoutDetailsForm", , , , , acHidden
Code:
Private Sub txtBarcode_AfterUpdate()
Dim strCriteria As String
Dim Cancel As Boolean
Dim rs As Object
strCriteria = "[signinID] =" & Me.txtBarcode
DoCmd.OpenForm "ContractorSignoutDetailsForm", , , , , acHidden
Set rs = Forms!ContractorSignoutDetailsForm.Recordset.Clone
rs.FindFirst (strCriteria)
If rs.NoMatch Then
MsgBox "No entry found"
DoCmd.Close acForm, "ContractorSignOutDetailsForm"
Me.txtBarcode.SetFocus
Else
'MsgBox "Entry found"
DoCmd.OpenForm "ContractorSignoutDetailsForm"
Forms!ContractorSignoutDetailsForm.Bookmark = rs.Bookmark
Me.txtBarcode.Undo
DoCmd.Close acForm, Me.Name
End If
Set rs = Nothing
End Sub