Can you use a combo box in a selct query

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

Guest

I know when I build a query that I can prompt a user to answer a question,
for ex. [Please list Last Name], which will filter the data. My question is,
instead of the user entering the data can you have a combo box come up so
they select the correct field. I want to do this so I can avoid people miss
spelling things and then not getting the data they need. Thanks for the Help
 
You can access the value selected in the combo box.

Assuming the combo is name CBox1 (not a good name for real world use!), the
value of the BOUND column is given by:

Me.CBox1

Just substitute in place of your parameter. That's all that should be
needed. This assumes that the bound column is in fact the FIRST column in
your combo box, even if it is not what is displayed in the selection list.

Good Luck!
 
Combo said:
I know when I build a query that I can prompt a user to answer a question,
for ex. [Please list Last Name], which will filter the data. My question is,
instead of the user entering the data can you have a combo box come up so
they select the correct field. I want to do this so I can avoid people miss
spelling things and then not getting the data they need. Thanks for the Help

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

Create a criteria form & run the query from the form. Use form
references in the query instead of pop-up prompts. E.g.:

SELECT *
FROM table_name
WHERE col_name = Forms!frmCriteria!ControlName

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

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

iQA/AwUBQt6vG4echKqOuFEgEQL/cgCfRZtgLwfTTjCnLSAepAJIoxL5AZAAn1gW
gmuqI83jZuJkRBj5cxFe65+9
=N+Nq
-----END PGP SIGNATURE-----
 
Thank you for the help, but know i have one more question and i should be
done. When i use this combo box it is showing duplicate entries because i
have duplicates in my table. Is there anyway to set up this combo box so
that it doesn't show duplicates.

Thanks,

Tim

Lynn Trapp said:
Put your combo box on a form and run your query from the form. The combobox
would then be the criteria:

Forms!YourFormName!YourComboBoxName

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



Combo box and Queries said:
I know when I build a query that I can prompt a user to answer a question,
for ex. [Please list Last Name], which will filter the data. My question
is,
instead of the user entering the data can you have a combo box come up so
they select the correct field. I want to do this so I can avoid people
miss
spelling things and then not getting the data they need. Thanks for the
Help
 
How is the combo box being populated? If from a query, make it a SELECT
DISTINCT
vs. just SELECT. The DISTINCT will take care of your dupes.

Good Luck!
--
Chaim


Combo box and Queries said:
Thank you for the help, but know i have one more question and i should be
done. When i use this combo box it is showing duplicate entries because i
have duplicates in my table. Is there anyway to set up this combo box so
that it doesn't show duplicates.

Thanks,

Tim

Lynn Trapp said:
Put your combo box on a form and run your query from the form. The combobox
would then be the criteria:

Forms!YourFormName!YourComboBoxName

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



Combo box and Queries said:
I know when I build a query that I can prompt a user to answer a question,
for ex. [Please list Last Name], which will filter the data. My question
is,
instead of the user entering the data can you have a combo box come up so
they select the correct field. I want to do this so I can avoid people
miss
spelling things and then not getting the data they need. Thanks for the
Help
 
It is being populated from a table

Chaim said:
How is the combo box being populated? If from a query, make it a SELECT
DISTINCT
vs. just SELECT. The DISTINCT will take care of your dupes.

Good Luck!
--
Chaim


Combo box and Queries said:
Thank you for the help, but know i have one more question and i should be
done. When i use this combo box it is showing duplicate entries because i
have duplicates in my table. Is there anyway to set up this combo box so
that it doesn't show duplicates.

Thanks,

Tim

Lynn Trapp said:
Put your combo box on a form and run your query from the form. The combobox
would then be the criteria:

Forms!YourFormName!YourComboBoxName

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



"Combo box and Queries" <Combo box and (e-mail address removed)>
wrote in message I know when I build a query that I can prompt a user to answer a question,
for ex. [Please list Last Name], which will filter the data. My question
is,
instead of the user entering the data can you have a combo box come up so
they select the correct field. I want to do this so I can avoid people
miss
spelling things and then not getting the data they need. Thanks for the
Help
 
Do not post same question in different groups. Not etiquette to cause people
to spend time answering a question that is already answered elsewhere.
--
Chaim


Combo box and Queries said:
Thank you for the help, but know i have one more question and i should be
done. When i use this combo box it is showing duplicate entries because i
have duplicates in my table. Is there anyway to set up this combo box so
that it doesn't show duplicates.

Thanks,

Tim

Lynn Trapp said:
Put your combo box on a form and run your query from the form. The combobox
would then be the criteria:

Forms!YourFormName!YourComboBoxName

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



Combo box and Queries said:
I know when I build a query that I can prompt a user to answer a question,
for ex. [Please list Last Name], which will filter the data. My question
is,
instead of the user entering the data can you have a combo box come up so
they select the correct field. I want to do this so I can avoid people
miss
spelling things and then not getting the data they need. Thanks for the
Help
 
The first question I should ask is "why do you have duplicates in your
table?" That's a no-no. If you can't avoid the duplicates, then you can do
something like this as the control source for your combobox:

Select Distinct PersonName
From YourTable;

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



Combo box and Queries said:
Thank you for the help, but know i have one more question and i should be
done. When i use this combo box it is showing duplicate entries because i
have duplicates in my table. Is there anyway to set up this combo box so
that it doesn't show duplicates.

Thanks,

Tim

Lynn Trapp said:
Put your combo box on a form and run your query from the form. The
combobox
would then be the criteria:

Forms!YourFormName!YourComboBoxName

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



"Combo box and Queries" <Combo box and (e-mail address removed)>
wrote in message
I know when I build a query that I can prompt a user to answer a
question,
for ex. [Please list Last Name], which will filter the data. My
question
is,
instead of the user entering the data can you have a combo box come up
so
they select the correct field. I want to do this so I can avoid people
miss
spelling things and then not getting the data they need. Thanks for
the
Help
 
Back
Top