Can I use one combo box to populate two fields VendorID & VendorNa

J

Jim in Spokane

SELECT dbo_VENDOR.ID, dbo_VENDOR.NAME, dbo_VENDOR.ID+' - '+dbo_VENDOR.NAME AS
VendorIDName
FROM dbo_VENDOR

Seems I can only get one or the other.

Do I need to use additional expressions or coding?

Thanks!
 
A

Arvin Meyer [MVP]

First change the name of the field "Name" to something like "VendorName".
Name is a reserved word in Access and many programming languages.

In the AfterUpdate event of the combo, set the Name field, like:

Private Sub cboVendor_AfterUpdate()
Me.txtVendorName = Me.cboVendor.Column(1)
End Sub
 
J

John W. Vinson

SELECT dbo_VENDOR.ID, dbo_VENDOR.NAME, dbo_VENDOR.ID+' - '+dbo_VENDOR.NAME AS
VendorIDName
FROM dbo_VENDOR

Seems I can only get one or the other.

Do I need to use additional expressions or coding?

Thanks!

Unless you have some very unusual requirement, you *should't* do this. Storing
the Vendor Name redundantly in a second table is generally a Bad Thing To Do.

Just store the vendor ID, and use a Query (or a Combo Box or a DLookUp or any
of a lot of other tools) to display it when needed. If you store the name in
both tables, you're wasting space and risking data corruption if one of the
table's VendorName field gets edited and the other doesn't.
 

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