View Full Version : updating a field in a table


aymanmb
01-28-2007, 11:33 AM
Dear all,

I have a simple database with few tables for which I created forms for the user to enter data.

I craeted in one ofthe forms a ombobox that reads from a table (list of suppliers fro example). I want the user to be able to select a supplier name and then this selected name will be fed to another table (order form for example). I did all requested work as I could understand bi\ut the end results is that it writes only the corresoponding ID number (e.g. 3) of the supplier and the supplier name itself (text).

Am I doing something wrong or missing a code?

appreciate helping a newbie

regards

neileg
01-29-2007, 01:53 AM
That's the way relational databases work. Storing the ID is the correct way of doing it. If you want to show the name, use a query to join to the supplier table.

Moniker
01-29-2007, 06:51 PM
What he's saying is, your structure is right.


SupplierTable

SupplierID SupplierName
1 Supplier1
2 Supplier2
3 Supplier3
. .
X SupplierX

OrderTable

OrderID SupplierID OrderDetails
1 1 Some_detail_field_here
2 1 " "
3 2 " "
. . .
X X X

The above is right (albeit simplied). To get the Supplier's Name to say put it on an invoice, a very easy wasy is with a DLookUp, like so:

Supplier_Name_Field = DLookUp("[SupplierName]","SupplierTable",[SupplierID]=" & SupplierIDField)

aymanmb
01-30-2007, 09:10 AM
thanks but where should I put that code