Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 2000

Status
Not open for further replies.

Cia2a

Technical User
Aug 8, 2000
23
0
0
US
I have a DB with a text field for computer parts, I also have a field for the part number. On the form for data entry how can I have the part number field automatically insert the part number based on the part name I enter in the part name. For example I enter Keyboard in part name field, and I want the associated P/N 20340-1 automatically inserted based on this.

Thanks all
 

Seems that you have a finite number of partnames which you could have expressed on your form either as a list box or a combo box. You could have a second combo of part numbers which have a key relationship with the part which would allow for a quick choice. Obviously if there is only one choice for part nbr, it becomes the obvious value for the second field.

Robert Berman
 
you could use the Dlookup Function the criteria is this

DLookup(expr, domain[, criteria])

Here is an example of how to use it

Me.TextBoxP/N = DLookup ("[P/N Field]", "P/N Table", "P/NTable.P/Nname = '" & Me.P/Nname "'")

Me.TextBoxP/N is the name of the text box you type the Computer part in.

"[P/N Field]" is the name of the field in the table that holds the Part Number.

"P/N Table" is the name of the Table that holds the Part Number.

the criteria part is as follows
P/NTable.P/Nname is the table name with the dot seperator and the field name that holds the part number.
Me.P/Nname is the name odf the text box that you type the name of the computer part.

Notice that everything in the DLookup Function is in String format, so it is important in the criteria section you get all of the quotes in the correct spot.

HTH Dave
ToeShot@Hotmail.com
Today Is Tomorrows Yesterday. So Why Wait
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top