User Forms & Checking Inputs

  • Thread starter Thread starter Jez
  • Start date Start date
J

Jez

Hi please help...

I have a user form in Excel which collates all the information I need, and
then updates into a table in an access database.

I am trying to understand that when I input a job number in the form that it
then runs a query to the database and finds out if that job number exists in
the table already, and if so then it alerts me to say allready in database.
How can I do this?
 
Jez,

Put the code needed to check the job number in the function

Private Sub txtJobNum_Change()
' code to check the value
End Sub

This goes in the code for the user form. txtJobNum is the name of the
text box on the form. You will have to
devise code to not allow the form processing to complete until the
user corrects the situation. For example,
you could throw up a msgBox with OK and Cancel buttons. But a better
solution would be to give the
user the next available job number rather than having him/her guess.
Search the DB for the largest one
already there and write that number plus 1 into txtJobNum as the
default value.

Ed
 

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