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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code Problems

Status
Not open for further replies.

Ielamrani

MIS
Jul 7, 2005
183
US
Hi,
Can anyone tell me what's wrong with this code?

Private Sub cmbProvWrkCde_LostFocus()
If txtProviderID = "*P" And cmbProvWrkCde = "P-X" Then
MsgBox "Inactivating PCP Office Location Needs Approval From Director Of Department", vbOKOnly, "Password"

End If
End Sub


I am trying to send a message box everytime txtProviderID = Number that end with P (e.g. 145879P) and cmbProvWrkCde = P-X.

Thanks in advance.
Ismail
 
If Right(txtProviderID, 1) = "P" And cmbProvWrkCde = "P-X" Then

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Man that was quick and it worked. Thank you very much.
Ismail
 
Please also move the data validation code to the comboboxes' BeforeUpdate() event; this will prevent people from saving the changes before "losing focus" on the combobox. That or the form's BeforeUpdate() event. Note that you can prevent changes in these events (whereas in the LostFocus() event you cannot prevent anything).
 
Sorry to reply late. Thank you for your suggestions. I will change ther the data validation code.
Ismail
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top