User input found in data

B

Beards

I ask my clients to enter their userid into a temp_input field through an
inputbox. I want to look at a field [emp_uid] in the table [employee] to see
if the value in temp_input is in the table and if not, put up an error msg
and have them reenter their userid. Any Ideas?

Chris
 
L

LTofsrud

Hi Chris,

If all you are trying to do is a comparison based on what a user inputs
against an existing table, you could try something like this.

' temp_input could also be a textbox on the screen
Dim temp_input As Integer
Dim employee_ID As Long
temp_input = InputBox("Please enter your User ID.", "Require Input")

employee_ID = DLookup("[emp_uid]", "[employee]", "[emp_uid] = " &
Trim(temp_input))

If IsNull(employee_ID) Then
MsgBox "Could not find a employee ID matching the entered User ID.",
vbOKOnly + vbInformation, "No Match"
End If

Give that a shot and let me know if that is what you are looking for or not.

Lance
 
Top