G
Guest
Hello, here is a sample of my code. I'm trying to reset LuSN to the default
value(blank) if the record is not found. It works great if the record is
found utilizing the LuSN_Exit Sub. Is there a way to goto the LuSN_Exit Sub
from within the LuSN_BeforeUpdate Sub? Or is there a better way to reset it
to the default value?
Private Sub LuSN_BeforeUpdate(Cancel As Integer)
' Find the record that matches the control.
' Lookup SN (Combo48)
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[SN] = '" & Me![LuSN] & "'"
If rs.NoMatch Then
Dim strMessage As String, strTitle As String
strMessage = "Error Serial Number Not Found!"
strTitle = "Record Not Found"
Cancel = True
MsgBox strMessage, vbInformation + vbOKOnly, strTitle
End If
End Sub
Private Sub LuSN_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[SN] = '" & Me![LuSN] & "'"
If Not rs.EOF Then
Me.Bookmark = rs.Bookmark
End If
End Sub
Private Sub LuSN_Exit(Cancel As Integer)
Me.LuSN = Me.LuSN.DefaultValue
End Sub
value(blank) if the record is not found. It works great if the record is
found utilizing the LuSN_Exit Sub. Is there a way to goto the LuSN_Exit Sub
from within the LuSN_BeforeUpdate Sub? Or is there a better way to reset it
to the default value?
Private Sub LuSN_BeforeUpdate(Cancel As Integer)
' Find the record that matches the control.
' Lookup SN (Combo48)
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[SN] = '" & Me![LuSN] & "'"
If rs.NoMatch Then
Dim strMessage As String, strTitle As String
strMessage = "Error Serial Number Not Found!"
strTitle = "Record Not Found"
Cancel = True
MsgBox strMessage, vbInformation + vbOKOnly, strTitle
End If
End Sub
Private Sub LuSN_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[SN] = '" & Me![LuSN] & "'"
If Not rs.EOF Then
Me.Bookmark = rs.Bookmark
End If
End Sub
Private Sub LuSN_Exit(Cancel As Integer)
Me.LuSN = Me.LuSN.DefaultValue
End Sub