Parameter query and combo box

  • Thread starter Thread starter Aniko
  • Start date Start date
A

Aniko

Hi,
Is it possible to make the parameter query so that the item
to be queried on can be selected from a combo box?
Many thanks,
Aniko
 
No.

The only way you can do that is to use a form where the combo is.
Then use something like this as the parameter in your query:
[Forms].[Form1].[Combo1]

The form must be open before the query runs, or it pops up the standard
parameter dialog.
 
Thanks Allen,
I created a form with a combo box.
I created a macro, which opens the form and then opens the
query.
However, I don't think my Where statement is correct.
WHERE
(((AssetType.AssetTypeDescription)=([Form].[frmAssetsInquery].[cmbAssetType])))
What is missing?
Thanks for your time,
Aniko
-----Original Message-----
No.

The only way you can do that is to use a form where the combo is.
Then use something like this as the parameter in your query:
[Forms].[Form1].[Combo1]

The form must be open before the query runs, or it pops up the standard
parameter dialog.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Aniko said:
Hi,
Is it possible to make the parameter query so that the item
to be queried on can be selected from a combo box?
Many thanks,
Aniko


.
 
When you open the AssetType table in design view, what is the Data Type of
AssetTypeDescription?

You need the bound column of your combo box to match that kind of value.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Thanks Allen,
I created a form with a combo box.
I created a macro, which opens the form and then opens the
query.
However, I don't think my Where statement is correct.
WHERE
(((AssetType.AssetTypeDescription)=([Form].[frmAssetsInquery].[cmbAssetType])))
What is missing?
Thanks for your time,
Aniko
-----Original Message-----
No.

The only way you can do that is to use a form where the combo is.
Then use something like this as the parameter in your query:
[Forms].[Form1].[Combo1]

The form must be open before the query runs, or it pops up the standard
parameter dialog.


Aniko said:
Hi,
Is it possible to make the parameter query so that the item
to be queried on can be selected from a combo box?
Many thanks,
Aniko
 
HI,
When you open the AssetType table in design view, what is the Data Type of
AssetTypeDescription?

It is a text
You need the bound column of your combo box to match that
kind of value.

The bound column value is 1.

I thing it is the parameter in the query which is wrong,
but not sure how to get the value of the combo box.

Aniko
--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Thanks Allen,
I created a form with a combo box.
I created a macro, which opens the form and then opens the
query.
However, I don't think my Where statement is correct.
WHERE
(((AssetType.AssetTypeDescription)=([Form].[frmAssetsInquery].[cmbAssetType])))
What is missing?
Thanks for your time,
Aniko
-----Original Message-----
No.

The only way you can do that is to use a form where the combo is.
Then use something like this as the parameter in your query:
[Forms].[Form1].[Combo1]

The form must be open before the query runs, or it pops up the standard
parameter dialog.


Hi,
Is it possible to make the parameter query so that the item
to be queried on can be selected from a combo box?
Many thanks,
Aniko


.
 
If the first column of the combo is also text, and the text matches, then it
should be fine.

Actually, just noticed you don't have the "s" in Forms:
WHERE AssetType.AssetTypeDescription =
[Forms].[frmAssetsInquery].[cmbAssetType]

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

HI,
When you open the AssetType table in design view, what is the Data Type of
AssetTypeDescription?

It is a text
You need the bound column of your combo box to match that
kind of value.

The bound column value is 1.

I thing it is the parameter in the query which is wrong,
but not sure how to get the value of the combo box.

Aniko
 
Thanks again Allan,

Obviously I do not know much about these bound columns,
even after reading the help what it is all about.
The AssetType table is a simple to column table. First
column is the primary key, which has the Number Data type.
The second column is the text, which is the
AssetTypeDescription.
The properties of the combo box under the data tab in a
simple form is:
Control source : none
Imput mask : none
Row source type : Table/Queiry
Row source : SELECT [AssetType].[AssetTypeID],
[AssetType].[AssetTypeDescription] FROM [AssetType]
Bound column : 1
When activating the macro, the parameter query window
overrides the open table, not alowing to select the
AssetType for the query. However,the simple table is opened
in the background.

It seemed so simple, but is getting a bit more serious than
I thought.
Thanks for your help,
Aniko
-----Original Message-----
If the first column of the combo is also text, and the text matches, then it
should be fine.

Actually, just noticed you don't have the "s" in Forms:
WHERE AssetType.AssetTypeDescription =
[Forms].[frmAssetsInquery].[cmbAssetType]

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

HI,
When you open the AssetType table in design view, what is the Data Type of
AssetTypeDescription?

It is a text
You need the bound column of your combo box to match that
kind of value.

The bound column value is 1.

I thing it is the parameter in the query which is wrong,
but not sure how to get the value of the combo box.

Aniko


.
 
The RowSource of your combo has 2 columns.
The Bound Column is #1, which is the number.
You need to refer to the 2nd column to get the text description.

The Column property is zero based, (i.e. the first column is number zero),
so try:
WHERE AssetType.AssetTypeDescription =
[Forms].[frmAssetsInquery].[cmbAssetType].Column(1)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Aniko said:
Thanks again Allan,

Obviously I do not know much about these bound columns,
even after reading the help what it is all about.
The AssetType table is a simple to column table. First
column is the primary key, which has the Number Data type.
The second column is the text, which is the
AssetTypeDescription.
The properties of the combo box under the data tab in a
simple form is:
Control source : none
Imput mask : none
Row source type : Table/Queiry
Row source : SELECT [AssetType].[AssetTypeID],
[AssetType].[AssetTypeDescription] FROM [AssetType]
Bound column : 1
When activating the macro, the parameter query window
overrides the open table, not alowing to select the
AssetType for the query. However,the simple table is opened
in the background.

It seemed so simple, but is getting a bit more serious than
I thought.
Thanks for your help,
Aniko
-----Original Message-----
If the first column of the combo is also text, and the text matches, then it
should be fine.

Actually, just noticed you don't have the "s" in Forms:
WHERE AssetType.AssetTypeDescription =
[Forms].[frmAssetsInquery].[cmbAssetType]


HI,
When you open the AssetType table in design view, what is the Data Type of
AssetTypeDescription?

It is a text
You need the bound column of your combo box to match that
kind of value.

The bound column value is 1.

I thing it is the parameter in the query which is wrong,
but not sure how to get the value of the combo box.

Aniko
 
Hi,
I added the Column(1) to the Where statement, but it still
doen't work, I think I just need to give it a miss.
It would be a nice feature, but I might just use the LIKE
commnad in the criteria.
Thanks all the same,
Aniko
-----Original Message-----
The RowSource of your combo has 2 columns.
The Bound Column is #1, which is the number.
You need to refer to the 2nd column to get the text description.

The Column property is zero based, (i.e. the first column is number zero),
so try:
WHERE AssetType.AssetTypeDescription =
[Forms].[frmAssetsInquery].[cmbAssetType].Column(1)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Aniko said:
Thanks again Allan,

Obviously I do not know much about these bound columns,
even after reading the help what it is all about.
The AssetType table is a simple to column table. First
column is the primary key, which has the Number Data type.
The second column is the text, which is the
AssetTypeDescription.
The properties of the combo box under the data tab in a
simple form is:
Control source : none
Imput mask : none
Row source type : Table/Queiry
Row source : SELECT [AssetType].[AssetTypeID],
[AssetType].[AssetTypeDescription] FROM [AssetType]
Bound column : 1
When activating the macro, the parameter query window
overrides the open table, not alowing to select the
AssetType for the query. However,the simple table is opened
in the background.

It seemed so simple, but is getting a bit more serious than
I thought.
Thanks for your help,
Aniko
-----Original Message-----
If the first column of the combo is also text, and the text matches, then it
should be fine.

Actually, just noticed you don't have the "s" in Forms:
WHERE AssetType.AssetTypeDescription =
[Forms].[frmAssetsInquery].[cmbAssetType]


HI,
When you open the AssetType table in design view, what is
the Data Type of
AssetTypeDescription?

It is a text

You need the bound column of your combo box to match that
kind of value.

The bound column value is 1.

I thing it is the parameter in the query which is wrong,
but not sure how to get the value of the combo box.

Aniko


.
 
Back
Top