how to call a database combo box using query expression

J

John James

when in expression builder, i want to call a combo box defined on a form so
that the parameter query shows this combo and accepts its selection as the
parameter needed by the query. what is the format of this ? An example would
be greatly apreciated. The form name is form1 and the query is called query1
and the combobox is called combo1. thanks in advance.
 
J

Joe Fallon

1. Forms![FormName]![cboName]

2. Like
iif(isnull(Forms![FormName]![cboName],'*',Forms![FormName]![cboName])

I prefer #2 since it allows you to leave the cbo blank and still use it as
criteria to return all records.
The caveat is that the data underlying the cbo should not have any Nulls.
(Mine never do so it is a non-issue for me.)
 
J

John James

thanks
Joe Fallon said:
1. Forms![FormName]![cboName]

2. Like
iif(isnull(Forms![FormName]![cboName],'*',Forms![FormName]![cboName])

I prefer #2 since it allows you to leave the cbo blank and still use it as
criteria to return all records.
The caveat is that the data underlying the cbo should not have any Nulls.
(Mine never do so it is a non-issue for me.)
--
Joe Fallon
Access MVP



John James said:
when in expression builder, i want to call a combo box defined on a form so
that the parameter query shows this combo and accepts its selection as the
parameter needed by the query. what is the format of this ? An example would
be greatly apreciated. The form name is form1 and the query is called query1
and the combobox is called combo1. thanks in advance.
 
Top