By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,044 Members | 1,720 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,044 IT Pros & Developers. It's quick & easy.

combo box in query

P: n/a
How can i include a combo box in the criteria field in a parameter query

Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
The syntax to refer to the control on a form is:

Forms!frmFormName!ctlContolName

on a subform:
Forms!frmParentFormName!ctlSubformControlName.Form !ctlControlName

The ctlSubformControlName is the name of the control on the main form that holds the
subform, not the name of the subform itself.

--
Wayne Morgan
Microsoft Access MVP
"LouD" <du******@yahoo.com> wrote in message
news:3Z*********************@news-server.bigpond.net.au...
How can i include a combo box in the criteria field in a parameter query

Nov 12 '05 #2

P: n/a
where do I put this syntax, at the mom what i have in the criteria field
is [enter name here]

Wayne Morgan wrote:
The syntax to refer to the control on a form is:

Forms!frmFormName!ctlContolName

on a subform:
Forms!frmParentFormName!ctlSubformControlName.Form !ctlControlName

The ctlSubformControlName is the name of the control on the main form that holds the
subform, not the name of the subform itself.


Nov 12 '05 #3

P: n/a
Place it in the criteria field instead of what you have. Access will probably put brackets
around each part when you are done. The form must be open (visible or hidden is ok) for
this to work.

Remember the value of a combo box is the value of the Bound Column for the row that is
selected. If the value you are looking for is in a different column, you will need to
specify the column.

--
Wayne Morgan
Microsoft Access MVP
"LouD" <du******@yahoo.com> wrote in message
news:sg*******************@news-server.bigpond.net.au...
where do I put this syntax, at the mom what i have in the criteria field
is [enter name here]

Wayne Morgan wrote:
The syntax to refer to the control on a form is:

Forms!frmFormName!ctlContolName

on a subform:
Forms!frmParentFormName!ctlSubformControlName.Form !ctlControlName

The ctlSubformControlName is the name of the control on the main form that holds the
subform, not the name of the subform itself.

Nov 12 '05 #4

P: n/a
Wayne

I tried suggesting what you said but it stll comes up as a msg text box
not a msg combo box heres is the sql the was genrated when i used to
wizard to set up the query
SELECT tblDetail.Det_ID, tblCategory.Cat_Code, tblName.Plant_Name,
tblName.Generic_Name, tblContainer.Cont_Size, tblDetail.Cost,
tblDetail.Price, tblDetail.Quantity, tblLocation.Loc_Code
FROM tblName INNER JOIN (tblLocation INNER JOIN (tblContainer INNER JOIN
(tblCategory INNER JOIN tblDetail ON tblCategory.Cat_ID =
tblDetail.Cat_ID) ON tblContainer.Cont_ID = tblDetail.Cont_ID) ON
tblLocation.Loc_ID = tblDetail.Loc_ID) ON tblName.Plant_ID =
tblDetail.Plant_ID
GROUP BY tblDetail.Det_ID, tblCategory.Cat_Code, tblName.Plant_Name,
tblName.Generic_Name, tblContainer.Cont_Size, tblDetail.Cost,
tblDetail.Price, tblDetail.Quantity, tblLocation.Loc_Code
HAVING (((tblName.Plant_Name) Like "*" & [Enter the plant name or frist
characters of the name:] & "*"));

Yr assitance appreciated

Wayne Morgan wrote:
Place it in the criteria field instead of what you have. Access will probably put brackets
around each part when you are done. The form must be open (visible or hidden is ok) for
this to work.

Remember the value of a combo box is the value of the Bound Column for the row that is
selected. If the value you are looking for is in a different column, you will need to
specify the column.


Nov 12 '05 #5

P: n/a
You're right, doing it this way won't bring up a combo box. To bring up a combo box you
will need to create your own form with a combo box on it then have the query's criteria
refer to that combo box.

What are you using this query for? If it is for another form or a report, you could pop-up
the form with the combo box in the OnOpen event of this other form or report using the
acDialog window mode argument. This will pause the code until you hide or close (you'll
have to hide it for the query to see it because it has to be open) the pop-up form and
will allow the value in the combo box to be set before the query is looking for it.
HAVING (((tblName.Plant_Name) Like "*" & [Forms]![frmFormName]![ctlContolName] & "*"));
--
Wayne Morgan
Microsoft Access MVP
"LouD" <du******@yahoo.com> wrote in message
news:83*********************@news-server.bigpond.net.au... Wayne

I tried suggesting what you said but it stll comes up as a msg text box
not a msg combo box heres is the sql the was genrated when i used to
wizard to set up the query
SELECT tblDetail.Det_ID, tblCategory.Cat_Code, tblName.Plant_Name,
tblName.Generic_Name, tblContainer.Cont_Size, tblDetail.Cost,
tblDetail.Price, tblDetail.Quantity, tblLocation.Loc_Code
FROM tblName INNER JOIN (tblLocation INNER JOIN (tblContainer INNER JOIN
(tblCategory INNER JOIN tblDetail ON tblCategory.Cat_ID =
tblDetail.Cat_ID) ON tblContainer.Cont_ID = tblDetail.Cont_ID) ON
tblLocation.Loc_ID = tblDetail.Loc_ID) ON tblName.Plant_ID =
tblDetail.Plant_ID
GROUP BY tblDetail.Det_ID, tblCategory.Cat_Code, tblName.Plant_Name,
tblName.Generic_Name, tblContainer.Cont_Size, tblDetail.Cost,
tblDetail.Price, tblDetail.Quantity, tblLocation.Loc_Code
HAVING (((tblName.Plant_Name) Like "*" & [Enter the plant name or frist
characters of the name:] & "*"));

Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.