T
Todd
I have a form where users update equipment status.
Although Drop down boxes are used to enter most of the
status categories, there are still opportunities for data
entry error.
What I would like to do is a check before they update the
record, to ensure that the data entry is correct. I know
how to do basic checks based on the data that they've
entered.
For Example (inserted in BeforeUpdate event)
If (Me.Combo18 = "Returned" Or Me.Combo18 = "Frozen" Or
Me.Combo18 = "Shipped" Or Me.Combo18 = "Filled" Or
Me.Combo18 = "Thawed") And IsNull(Me.Combo23) Then
ReadyToClose = False
userreply = MsgBox("You must enter a LOT Number for the
Status category that you chose", 0, "Error")
If userreply = vbOK Then
Me.Combo23.SetFocus
End If
End If
This works fine.
However, what I don't know how to do is to check there
entry against previous entries to ensure that it is
correct.
So what I'd like to be able to do, is figure out how to
write the code to do this (again I plan to insert this
into the BeforeUpdate event code):
Run a query based on the vessel number that the user has
input to find what the current lot number is in the
vessel, and then compare that to the lot number that they
have just tried to enter. So, how do you run a query from
within the code function?
I'm thinking that the general format is going to look like
this,***'s are where I have a problem:
If (Me.Combo18 = "Returned" Or Me.Combo18 = "Shipped" Or
Me.Combo18 = "Filled" Or Me.Combo18 = "Thawed") And
***QUERY RESULTS FOR CURRENT LOT IN VESSEL ENTERED ON
FORM*** <> Me.Combo.23 Then
ReadyToClose = False
userreply = MsgBox("You must enter a Bin Number for the
Status category that you chose", 0, "Error")
If userreply = vbOK Then
Me.Combo23.SetFocus
End If
End If
Thanks for any help.
Although Drop down boxes are used to enter most of the
status categories, there are still opportunities for data
entry error.
What I would like to do is a check before they update the
record, to ensure that the data entry is correct. I know
how to do basic checks based on the data that they've
entered.
For Example (inserted in BeforeUpdate event)
If (Me.Combo18 = "Returned" Or Me.Combo18 = "Frozen" Or
Me.Combo18 = "Shipped" Or Me.Combo18 = "Filled" Or
Me.Combo18 = "Thawed") And IsNull(Me.Combo23) Then
ReadyToClose = False
userreply = MsgBox("You must enter a LOT Number for the
Status category that you chose", 0, "Error")
If userreply = vbOK Then
Me.Combo23.SetFocus
End If
End If
This works fine.
However, what I don't know how to do is to check there
entry against previous entries to ensure that it is
correct.
So what I'd like to be able to do, is figure out how to
write the code to do this (again I plan to insert this
into the BeforeUpdate event code):
Run a query based on the vessel number that the user has
input to find what the current lot number is in the
vessel, and then compare that to the lot number that they
have just tried to enter. So, how do you run a query from
within the code function?
I'm thinking that the general format is going to look like
this,***'s are where I have a problem:
If (Me.Combo18 = "Returned" Or Me.Combo18 = "Shipped" Or
Me.Combo18 = "Filled" Or Me.Combo18 = "Thawed") And
***QUERY RESULTS FOR CURRENT LOT IN VESSEL ENTERED ON
FORM*** <> Me.Combo.23 Then
ReadyToClose = False
userreply = MsgBox("You must enter a Bin Number for the
Status category that you chose", 0, "Error")
If userreply = vbOK Then
Me.Combo23.SetFocus
End If
End If
Thanks for any help.