criteria

  • Thread starter Thread starter Phil Boorman
  • Start date Start date
P

Phil Boorman

Is it possible to limit a search criteria in a query to a combo box list?
When I put "[Please enter the search criteria]" in the criteria for a query
based on a table with a combo box the entry must match exactly or it returns
nothing.

Thank You,

Phil
 
Phil said:
Is it possible to limit a search criteria in a query to a combo box list?
When I put "[Please enter the search criteria]" in the criteria for a query
based on a table with a combo box the entry must match exactly or it returns
nothing.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Create a form and on that form create a ComboBox w/ that displays the
same data as the ComboBox in the table. In the query use PARAMETERS
like this:

PARAMETERS Forms!FormName!ComboBoxName <data type>;
SELECT...
FROM ...
WHERE column_name = Forms!FormName!ComboBoxName

Substitute your form and column names in the above. The <data type>
should be whatever value is returned from the Combo Box (the Bound
Column data type).

Show the form to the user & have a CommandButton that when clicked,
checks that there is a valid value in the ComboBox and then runs the
query. The query will read the selected value from the ComboBox.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQmKXtoechKqOuFEgEQJzUwCcCHo0NKVVKejvKsyozJCZa8uKlTcAoK4D
9NlnycgY4F7V1XOMaLHD8dqw
=njLK
-----END PGP SIGNATURE-----
 
I must be doing something wrong.

Here is what I have entered in the criteria cell;

PARAMETERS Forms!Fee'sIn!DepositBundle<Text>;
SELECT...
FROM ...
WHERE DepositBundle= Forms!Fee'sIn!DepositBundle

I get an error message "The expression you entered contains invalid syntax.
You may have entered an operand without an operator."

Phil



MGFoster said:
Phil said:
Is it possible to limit a search criteria in a query to a combo box list?
When I put "[Please enter the search criteria]" in the criteria for a
query based on a table with a combo box the entry must match exactly or
it returns nothing.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Create a form and on that form create a ComboBox w/ that displays the
same data as the ComboBox in the table. In the query use PARAMETERS
like this:

PARAMETERS Forms!FormName!ComboBoxName <data type>;
SELECT...
FROM ...
WHERE column_name = Forms!FormName!ComboBoxName

Substitute your form and column names in the above. The <data type>
should be whatever value is returned from the Combo Box (the Bound
Column data type).

Show the form to the user & have a CommandButton that when clicked,
checks that there is a valid value in the ComboBox and then runs the
query. The query will read the selected value from the ComboBox.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQmKXtoechKqOuFEgEQJzUwCcCHo0NKVVKejvKsyozJCZa8uKlTcAoK4D
9NlnycgY4F7V1XOMaLHD8dqw
=njLK
-----END PGP SIGNATURE-----
 
You might want to avoid creating objects with apostrophes in their names. I
recommend avoiding all spaces, punctuation, symbols, reserved words,
function names, etc. Consider using a good naming convention as noted at
http://www.granite.ab.ca/access/tablefieldnaming.htm

--
Duane Hookom
MS Access MVP


Phil Boorman said:
I must be doing something wrong.

Here is what I have entered in the criteria cell;

PARAMETERS Forms!Fee'sIn!DepositBundle<Text>;
SELECT...
FROM ...
WHERE DepositBundle= Forms!Fee'sIn!DepositBundle

I get an error message "The expression you entered contains invalid
syntax. You may have entered an operand without an operator."

Phil



MGFoster said:
Phil said:
Is it possible to limit a search criteria in a query to a combo box
list? When I put "[Please enter the search criteria]" in the criteria
for a query based on a table with a combo box the entry must match
exactly or it returns nothing.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Create a form and on that form create a ComboBox w/ that displays the
same data as the ComboBox in the table. In the query use PARAMETERS
like this:

PARAMETERS Forms!FormName!ComboBoxName <data type>;
SELECT...
FROM ...
WHERE column_name = Forms!FormName!ComboBoxName

Substitute your form and column names in the above. The <data type>
should be whatever value is returned from the Combo Box (the Bound
Column data type).

Show the form to the user & have a CommandButton that when clicked,
checks that there is a valid value in the ComboBox and then runs the
query. The query will read the selected value from the ComboBox.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQmKXtoechKqOuFEgEQJzUwCcCHo0NKVVKejvKsyozJCZa8uKlTcAoK4D
9NlnycgY4F7V1XOMaLHD8dqw
=njLK
-----END PGP SIGNATURE-----
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

As Mr. Hookom says, don't put apostrophes in object names. And "Fee's
In" would be [Fees In], anyway, 'cuz it is not possesive, but plural.
The correct syntax for the form reference parameter is:

PARAMETERS Forms!FeesIn!DepositBundle Text;

There aren't any angle brackets around the data type name. I used them
in my example to indicate something to be replaced. Which means
substitute the data type for the complete phrase "<data type>." The
angle brackets is a BNF syntax indicator.

Info on BNF:

http://www.dataip.co.uk/Reference/BNF.php

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQmP0toechKqOuFEgEQLDnACcCuR7Dim2Mjfyy7wzqgLrHL/MnasAoOHW
0YO51vg7ISrx6J2h9d2aNZYA
=2xML
-----END PGP SIGNATURE-----

Phil said:
I must be doing something wrong.

Here is what I have entered in the criteria cell;

PARAMETERS Forms!Fee'sIn!DepositBundle<Text>;
SELECT...
FROM ...
WHERE DepositBundle= Forms!Fee'sIn!DepositBundle

I get an error message "The expression you entered contains invalid syntax.
You may have entered an operand without an operator."

Phil



Phil said:
Is it possible to limit a search criteria in a query to a combo box list?
When I put "[Please enter the search criteria]" in the criteria for a
query based on a table with a combo box the entry must match exactly or
it returns nothing.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Create a form and on that form create a ComboBox w/ that displays the
same data as the ComboBox in the table. In the query use PARAMETERS
like this:

PARAMETERS Forms!FormName!ComboBoxName <data type>;
SELECT...
FROM ...
WHERE column_name = Forms!FormName!ComboBoxName

Substitute your form and column names in the above. The <data type>
should be whatever value is returned from the Combo Box (the Bound
Column data type).

Show the form to the user & have a CommandButton that when clicked,
checks that there is a valid value in the ComboBox and then runs the
query. The query will read the selected value from the ComboBox.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQmKXtoechKqOuFEgEQJzUwCcCHo0NKVVKejvKsyozJCZa8uKlTcAoK4D
9NlnycgY4F7V1XOMaLHD8dqw
=njLK
-----END PGP SIGNATURE-----
 
Thank you for your reply.

There was a more fundamental problem than just my syntax (or grammar). I was
trying to run the query from the query as opposed to the form.


MGFoster said:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

As Mr. Hookom says, don't put apostrophes in object names. And "Fee's
In" would be [Fees In], anyway, 'cuz it is not possesive, but plural.
The correct syntax for the form reference parameter is:

PARAMETERS Forms!FeesIn!DepositBundle Text;

There aren't any angle brackets around the data type name. I used them
in my example to indicate something to be replaced. Which means
substitute the data type for the complete phrase "<data type>." The
angle brackets is a BNF syntax indicator.

Info on BNF:

http://www.dataip.co.uk/Reference/BNF.php

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQmP0toechKqOuFEgEQLDnACcCuR7Dim2Mjfyy7wzqgLrHL/MnasAoOHW
0YO51vg7ISrx6J2h9d2aNZYA
=2xML
-----END PGP SIGNATURE-----

Phil said:
I must be doing something wrong.

Here is what I have entered in the criteria cell;

PARAMETERS Forms!Fee'sIn!DepositBundle<Text>;
SELECT...
FROM ...
WHERE DepositBundle= Forms!Fee'sIn!DepositBundle

I get an error message "The expression you entered contains invalid
syntax. You may have entered an operand without an operator."

Phil



Phil Boorman wrote:

Is it possible to limit a search criteria in a query to a combo box
list? When I put "[Please enter the search criteria]" in the criteria
for a query based on a table with a combo box the entry must match
exactly or it returns nothing.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Create a form and on that form create a ComboBox w/ that displays the
same data as the ComboBox in the table. In the query use PARAMETERS
like this:

PARAMETERS Forms!FormName!ComboBoxName <data type>;
SELECT...
FROM ...
WHERE column_name = Forms!FormName!ComboBoxName

Substitute your form and column names in the above. The <data type>
should be whatever value is returned from the Combo Box (the Bound
Column data type).

Show the form to the user & have a CommandButton that when clicked,
checks that there is a valid value in the ComboBox and then runs the
query. The query will read the selected value from the ComboBox.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQmKXtoechKqOuFEgEQJzUwCcCHo0NKVVKejvKsyozJCZa8uKlTcAoK4D
9NlnycgY4F7V1XOMaLHD8dqw
=njLK
-----END PGP SIGNATURE-----
 
Back
Top