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

Control on Multipage Form

Status
Not open for further replies.

taylornow

Technical User
Oct 16, 2000
90
US
I have a multipage form with quite a bit of info that needs to be entered. The employeeID is set for no duplicates due to the fact that many people enter data from different sources. Is there a way to notify them it is a duplicate before they are at the end of the form? Is there a way to set a contol on the EmployeeID field that will tell them when they tab to the next field instead of at the end ?

Thanks in advance
Taylor
 
As I said on your last post, you can try to save the record immediately after the EmployeeID field is updated, which will cause an error if there are duplicates, letting the user know that the EmployeeID already exists.

Private Sub EmployeeID_AfterUpdate()
DoCmd.RunCommand acCmdSaveRecord
End Sub Mike Rohde
rohdem@marshallengines.com
 
Thank you. I apologize for missing the first response you gave me.

Taylor
 
You could use code like this:

Private Sub txtEmpNo_LostFocus()
If Not IsNull DLookUp("EmployeeID","YourTable","[EmployeeID] = '" & txtEmpNo & "'") then
msgbox "Employee ID already exist",vbInformation,"Duplicate Employee ID"
txtEmpNo.SetFocus
end if
end sub

Hope this works - Shane
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top