G
Guest
Hello,
I have a bound form and two bound controls. Currently, in the beforeupdate()
event for control1, I am applying the uncommitted value as the defaultvalue
for itself, then undoing the record. I then want to set the focus to
control2. Unfortunately, I hit that darn error 2108 "You must save the field
before you can set focus... blah, blah" I understand why it's giving me the
error, but still, I'm looking for a solution.
What I'm trying to accomplish:
An employee scans (barcode) their EmployeeID, then they will scan a ticket
number. I have it programmed so that the program will "remember" their
Employee ID for a period of time, then reset it to null or the default. <--
This part works very well, but, when they scan in thier ID, I want the focus
to move to the second control. I don't want to save the record because the
second control is blank and their's nothing to record yet. Can anyone help
me? Thanks!!!
....I'm probably tired. I'm going home, maybe the answer will magically
appear tommorrow.
*snippet*
Private Sub txtEmployeeID_BeforeUpdate(Cancel As Integer)
If bolTimeOutIsPresent And (Not IsNull(txtEmployeeID)) Then
'change to new value
Me.txtEmployeeID.DefaultValue = txtEmployeeID
'reset counter
i = 0
Cancel = 1
Me.Undo
DoCmd.CancelEvent
Me.txtDTNumber.SetFocus
Else
'Me.Undo
'DoCmd.OpenForm "frmTryAgainDialog"
End If
End Sub
I have a bound form and two bound controls. Currently, in the beforeupdate()
event for control1, I am applying the uncommitted value as the defaultvalue
for itself, then undoing the record. I then want to set the focus to
control2. Unfortunately, I hit that darn error 2108 "You must save the field
before you can set focus... blah, blah" I understand why it's giving me the
error, but still, I'm looking for a solution.
What I'm trying to accomplish:
An employee scans (barcode) their EmployeeID, then they will scan a ticket
number. I have it programmed so that the program will "remember" their
Employee ID for a period of time, then reset it to null or the default. <--
This part works very well, but, when they scan in thier ID, I want the focus
to move to the second control. I don't want to save the record because the
second control is blank and their's nothing to record yet. Can anyone help
me? Thanks!!!
....I'm probably tired. I'm going home, maybe the answer will magically
appear tommorrow.
*snippet*
Private Sub txtEmployeeID_BeforeUpdate(Cancel As Integer)
If bolTimeOutIsPresent And (Not IsNull(txtEmployeeID)) Then
'change to new value
Me.txtEmployeeID.DefaultValue = txtEmployeeID
'reset counter
i = 0
Cancel = 1
Me.Undo
DoCmd.CancelEvent
Me.txtDTNumber.SetFocus
Else
'Me.Undo
'DoCmd.OpenForm "frmTryAgainDialog"
End If
End Sub