Lookup new to access

  • Thread starter Thread starter Rpettis31
  • Start date Start date
R

Rpettis31

I have an after event that prefills a text box with a factory number that is
on a purchase order (comes from the purchase order table). However, instead
of the factory number I would like to display the factory name instead of the
factory number. The factory numbers-names will be on a seperate table
tblFactories.

the field currently is set in code below.

Me.txtPlanningCell=Me.cboPurchaseOrder.column(8)
 
Me.txtPlanningCell=DLookUp("FactoryName","tblFactories","FactoryNumber=" &
Me.cboPurchaseOrder.column(8) & ")"

Make sure you put your actual Factory Name field and Factory Number field as
defined in your tblFactories table
 
I am not sure why but I am getting an error with this statement:
Me.txtFactoryName = Me.cmbxOrderNumber.Column(4)

Me.txtFactoryName=DLookup("FactoryName", "tblFactories", "PlanningCell=" &
Me.cmbxOrderNumber.Column (4) & ")"
 
I am not sure why but I am getting an error with this statement:
Me.txtFactoryName = Me.cmbxOrderNumber.Column(4)

Don't forget that the Column property is zero based: (4) means the *fifth*
column. If you want the fourth column in the combo's rowsource use (3).
 
I go from a compile error to a syntax error?

Not sure if my syntax below is wrong? Also how do I account for a value not
on the table?

Thanks
Robert
 
I go from a compile error to a syntax error?

Not sure if my syntax below is wrong? Also how do I account for a value not
on the table?

Since you didn't post "the syntax below", and since I know nothing about the
structure of your tables, the rowsource query of the combo, or the actual code
you're using all I can say is "I don't know".

You can use the combo's Not In List event to pop up a new form to enter a
value that doesn't match what the user typed in, but again... I don't know
what you are currently doing so I don't know if that's appropriate or not.
 
Back
Top