form criteria using a key for items listed in combo box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form which kicks off a query. The form has a combox where the names
are listed. I have the key hidden in the combox by setting its width to 0. I
want to reference that key (ID) in my criteria in my query and I tried adding
".Column(0)" as in [form].[formname].[comboxname].Column(0). This works in my
VB code when I msgbox it but when I used that in building the criteria for
the query, I get a message saying it is an undefined function.

Any clue, help or lead is appreciated.
 
Unfortunately, the Query engine doesn't understand that construct. You'll
have to have a hidden textbox on your form where you stuff the value in the
combobox's AfterUpdate event.
 
well, the value of a combobox control is taken from the BoundColumn.
assuming that the key field is the bound column, you should be able to just
refer to the control without specifying a column, as

[forms]![formname]![comboxname]

also, note that the correct syntax is plural [forms], not singular [form].

hth
 
Back
Top