Please Help: Create a custom dialog box that looks up values in a table

A

Amy M

Please help! I would like to create a custom dialog box that looks up values in a table with the control on the form as a combo box. Then I want to use the value I select from the combo box as criteria for a query. I have found a help topic that describes how to do this if I were typing in my value into the dialog box, but I want it to choose values from a list. Example: When I open a report I want a dialog box to prompt me with the question "Which Project?". I want to choose the project for which I want to run the report from a combo box based on my table where all my project names are stored.
 
R

Roger Carlson

You need to create a form. Let's call it frmSelectProject. On this form,
you have a combo box (cboProjects) and a button. You also have a query
named qryMyProjects. The code behind the button looks something like this:
DoCmd.OpenQuery "qryMyProjects", acNormal, acEdit

In the criteria of the Projects column in the query, put
[Forms]![frmSelectProject]![cboProjects].

Now, when you open the form, you can select a project and click the button
and it will open the query to that project.

On my website, (see sig below), there is a small sample database called
"ParaQuerySelect.mdb" which illustrates this.

--
--Roger Carlson
www.rogersaccesslibrary.com
Reply to: Roger dot Carlson at Spectrum-Health dot Org

Amy M said:
Please help! I would like to create a custom dialog box that looks up
values in a table with the control on the form as a combo box. Then I want
to use the value I select from the combo box as criteria for a query. I have
found a help topic that describes how to do this if I were typing in my
value into the dialog box, but I want it to choose values from a list.
Example: When I open a report I want a dialog box to prompt me with the
question "Which Project?". I want to choose the project for which I want to
run the report from a combo box based on my table where all my project
names are stored.
 
A

Amy M

When you said to build the query "qryMyProjects" what should go in there? Just my project names from my table with my project names so that I can use this query as the RecordSource for my dialog box (frmSelectProject") or did you mean for this to be the query that my report is based on (the one for which I want to select the project name)?

----- Roger Carlson wrote: ----

You need to create a form. Let's call it frmSelectProject. On this form
you have a combo box (cboProjects) and a button. You also have a quer
named qryMyProjects. The code behind the button looks something like this
DoCmd.OpenQuery "qryMyProjects", acNormal, acEdi

In the criteria of the Projects column in the query, pu
[Forms]![frmSelectProject]![cboProjects]

Now, when you open the form, you can select a project and click the butto
and it will open the query to that project

On my website, (see sig below), there is a small sample database calle
"ParaQuerySelect.mdb" which illustrates this

--
--Roger Carlso
www.rogersaccesslibrary.co
Reply to: Roger dot Carlson at Spectrum-Health dot Or

Amy M said:
Please help! I would like to create a custom dialog box that looks u
values in a table with the control on the form as a combo box. Then I wan
to use the value I select from the combo box as criteria for a query. I hav
found a help topic that describes how to do this if I were typing in m
value into the dialog box, but I want it to choose values from a list
Example: When I open a report I want a dialog box to prompt me with th
question "Which Project?". I want to choose the project for which I want t
run the report from a combo box based on my table where all my projec
names are stored
 
R

Roger Carlson

The latter. Since you didn't give the query name, I just made one up.

--
--Roger Carlson
www.rogersaccesslibrary.com
Reply to: Roger dot Carlson at Spectrum-Health dot Org

Amy M said:
When you said to build the query "qryMyProjects" what should go in there?
Just my project names from my table with my project names so that I can use
this query as the RecordSource for my dialog box (frmSelectProject") or did
you mean for this to be the query that my report is based on (the one for
which I want to select the project name)?
----- Roger Carlson wrote: -----

You need to create a form. Let's call it frmSelectProject. On this form,
you have a combo box (cboProjects) and a button. You also have a query
named qryMyProjects. The code behind the button looks something like this:
DoCmd.OpenQuery "qryMyProjects", acNormal, acEdit

In the criteria of the Projects column in the query, put
[Forms]![frmSelectProject]![cboProjects].

Now, when you open the form, you can select a project and click the button
and it will open the query to that project.

On my website, (see sig below), there is a small sample database called
"ParaQuerySelect.mdb" which illustrates this.

--
--Roger Carlson
www.rogersaccesslibrary.com
Reply to: Roger dot Carlson at Spectrum-Health dot Org

Amy M said:
Please help! I would like to create a custom dialog box that looks
up
values in a table with the control on the form as a combo box. Then I want
to use the value I select from the combo box as criteria for a query. I have
found a help topic that describes how to do this if I were typing in my
value into the dialog box, but I want it to choose values from a list.
Example: When I open a report I want a dialog box to prompt me with the
question "Which Project?". I want to choose the project for which I want to
run the report from a combo box based on my table where all my project
names are stored.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top