Newbie question

  • Thread starter Thread starter khhome06
  • Start date Start date
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.
 
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
 
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
 
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!!
 
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
 
Back
Top