Newbie question

K

khhome06

I'm new to access, please help, thank.

I create two table and form, one supplier table, with suppID, supName,
suppAddress.
The other equipment table with equipID, equipName, equipPrice and suppID as f
key.

In my equipment form, i have a textfield to key in suppID, but the problem is
the form accept any number, even though this suppID doesnt exist. How to make
sure the suppID enter in equipment form correspond to suppID in supplier
table. I've already done the relationship betwwen the two.

Thank in advance.
 
G

Guest

In the After Update event of the control where you enter the Supplier ID you
can use the DLookup function to determine if the supplier is in the Supplier
table. If the supplier is not in the table, the following function will
return Null.
Note the names used are made up. Change "Supplier Table" to your table name
and change Me.txtSupplier to the name of the control where you enter the
supplier id.

If IsNull(DLookup("[suppID]", "SupplierTable", [suppID] = '" &
Me.txtSupplier & "'")) Then
MsgBox "Supplier Is Not in Supplier Table")
End If
 
K

khhome06 via AccessMonster.com

A very thank for yuor help, i really appreciate it.
Thank again!
 
K

khhome06 via AccessMonster.com

A very thank for your help, i really appreciate it.
Thank again!
 
R

Ron2006

If you used a combo box instead you could "show" the supplier name but
store the SupplierID. And the user can more easily know that they got
the correct company.

Ron
 
K

khhome06 via AccessMonster.com

Ron2006 said:
If you used a combo box instead you could "show" the supplier name but
store the SupplierID. And the user can more easily know that they got
the correct company.

Ron

Hi Ron, u are amazing, a million thank to u, simple trick, great use and u
actually spend the effort to teach a newbie like me. Thank again!!
 
R

Ron2006

You are welcome. Keep lurking around in these forums and you will come
up with all sorts of new ideas and approaches.

Happy programming.

Ron
 

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

Top