Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditions of Code are met

Status
Not open for further replies.

LMRollins

MIS
Nov 14, 2000
120
US
I have code for my form. Is there a way to have the code stop if the conditions are met. Let's say that I have a msgbox popup if the contains a part number that requires the length to be entered. Once I enter the length, if I click on the part number field again and tab to another field the msgbox comes up again. I don't want it to popup if I've already filled in the length.
 
A couple of things. Are you storing the value of the length somewhere after they enter it?

If so you could check that before you use the msgbox.

You could also (but this may be frowned upon by some) use the .tag property of the part num field. After you have entered the length in the combo set the .tag property to true or some other value. Then for the code for prompting them for a length first check the tag property of the box and if is is empty then prompt them and if it is not empty then don't.

Anyway, hope this helps...

:)
 
Here is the code that I'm running. Granted it's probably not the best way but I'm new at this and it works but when I add in the part about checking for the conditions to be complete (which aren't in here) then it doesn't work.

Private Sub txtPart_ID_Exit(Cancel As Integer)
If IsNull(Me.txtPart_ID) Then
DoCmd.RunMacro "mcrPartidok"
Else
If DLookup("stock_um", "tblParts", "ID = '" & Me.txtPart_ID & "'") = "LN" Then
DoCmd.RunMacro "mcrLinInch"
Me.cckNoMaster = "off"
Else
If DLookup("stock_um", "tblParts", "ID = '" & Me.txtPart_ID & "'") = "SQI" Then
DoCmd.RunMacro "mcrSqInch"
Me.cckNoMaster = "off"
Else
If Not (Me.txtPart_ID = DLookup("ID", "tblParts")) Then
DoCmd.RunMacro "mcrNoPart"
End If
End If
End If
End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top