User input found in data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top