look up a value

R

Rpettis31

I have a combo box on a form that lists all the PO's in the database for a
form.
When the an item is selected then I assign values based on the PO selected
such as item number and description. However my table as a factory ID number
listed in the factory name text box and I would like to display the actual
factory name from the approved suppliers sheet.

However I am brain dead at the moment and can not think of how to do this.

Select Case CmbxOrderType.Value

Case "PO"
Me.TxtVendor = Me.cmbxOrderNumber.Column(11)
Me.txtLine = Me.cmbxOrderNumber.Column(1)
Me.txtItemDescription = Me.cmbxOrderNumber.Column(3)
Me.txtSpecificationNumber = Me.cmbxOrderNumber.Column(4)
Me.txtStdCost = Me.cmbxOrderNumber.Column(5)
Me.txtBuyer = Me.cmbxOrderNumber.Column(7)
Me.txtFactoryName = Me.cmbxOrderNumber.Column(8)
Me.cboItemNumber = Me.cmbxOrderNumber.Column(2)
Me.cboItemNumber.ColumnWidths = "1in"

I think I would like to say IF me.txtFactoryName <> "" Then do a query of
the value in the field but????
 
M

Marshall Barton

Rpettis31 said:
I have a combo box on a form that lists all the PO's in the database for a
form.
When the an item is selected then I assign values based on the PO selected
such as item number and description. However my table as a factory ID number
listed in the factory name text box and I would like to display the actual
factory name from the approved suppliers sheet.

However I am brain dead at the moment and can not think of how to do this.

Select Case CmbxOrderType.Value

Case "PO"
Me.TxtVendor = Me.cmbxOrderNumber.Column(11)
Me.txtLine = Me.cmbxOrderNumber.Column(1)
Me.txtItemDescription = Me.cmbxOrderNumber.Column(3)
Me.txtSpecificationNumber = Me.cmbxOrderNumber.Column(4)
Me.txtStdCost = Me.cmbxOrderNumber.Column(5)
Me.txtBuyer = Me.cmbxOrderNumber.Column(7)
Me.txtFactoryName = Me.cmbxOrderNumber.Column(8)
Me.cboItemNumber = Me.cmbxOrderNumber.Column(2)
Me.cboItemNumber.ColumnWidths = "1in"

I think I would like to say IF me.txtFactoryName <> "" Then do a query of
the value in the field but????


Well, you could do that using the DLookup function, but I
recommend that you modify the combo box's Row Source query
to Join to the Suppliers table. Then the name could be
included in the query and your code would be similar to the
other fields..
 
R

Rpettis31

I am assuming that with the table joined every time the factory number
appears it will actually only show the factory name.
 
M

Marshall Barton

Isn't that what you wanted or did I misunderstand?

If you tried it and did not get what you want, please post
Copy/Paste of your query's SQL view along with details about
the relevant fields their tables.
 

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