Query with Form as a parameter

G

Guest

Hi! I have created a small form with a combo box which I am using in a
query. However, when I call the form from the query criteria, it is not
bringing up the actual form that I have built. It brings up a regular
parameter box that reads exactly what was put into the criteria field of the
query. What am I doing wrong?

Here is what I have in the query criteria:
Forms![EmployeeParam]![cboEmployee]
 
G

Guest

Yes. When the user runs the query, the form should open to allow them to
enter the employee whose information they would like to review.

MJatAflac said:
Are you trying to open the form from the query?
--
Michal Joyce
Project Management IS Analyst
Aflac - Project Management Office


Amy said:
Hi! I have created a small form with a combo box which I am using in a
query. However, when I call the form from the query criteria, it is not
bringing up the actual form that I have built. It brings up a regular
parameter box that reads exactly what was put into the criteria field of the
query. What am I doing wrong?

Here is what I have in the query criteria:
Forms![EmployeeParam]![cboEmployee]
 
J

John Spencer

You cannot call a form from a query. You can call a query from a form using
VBA on a button's click event.

Open the form
Select the employee
Press the button. In the code behind the button's click event you would
have something like

DoCmd.OpenQuery "YourQueryName"


To add the code to the button,
open the form in design mode,
Right-click on the button,
Show properties, click on the events tab,
in the OnClick event select [Event Procedure],
click on the three dots at the end and enter the code above (replace
YourQueryName and keep the quote marks).
 
G

Guest

I think maybe I haven't explained it correctly. I have used the tips found
at http://www.fontstuff.com/access/acctut08.htm to help me set it up. Only,
when I get to step 2.3, it doesn't work. When it brings up a regular
parameter box instead of the form that I have built. Has anyone ever used
these instructions?

John Spencer said:
You cannot call a form from a query. You can call a query from a form using
VBA on a button's click event.

Open the form
Select the employee
Press the button. In the code behind the button's click event you would
have something like

DoCmd.OpenQuery "YourQueryName"


To add the code to the button,
open the form in design mode,
Right-click on the button,
Show properties, click on the events tab,
in the OnClick event select [Event Procedure],
click on the three dots at the end and enter the code above (replace
YourQueryName and keep the quote marks).


Amy said:
Hi! I have created a small form with a combo box which I am using in a
query. However, when I call the form from the query criteria, it is not
bringing up the actual form that I have built. It brings up a regular
parameter box that reads exactly what was put into the criteria field of
the
query. What am I doing wrong?

Here is what I have in the query criteria:
Forms![EmployeeParam]![cboEmployee]
 
J

John Spencer

In that case, check your spelling on the name of the control. If you have
spelled the name of the control one way on the form and slightly different
in the query, Access will display an input parameter box since it cannot
find what you are asking for.

Forms![EmployeeParam]![cboEmployee]
So, is the form named EmployeeParam?
Is the combobox named CboEmployee?

I've not stepped through the example, but it appears to be detailed and
correct.


Amy said:
I think maybe I haven't explained it correctly. I have used the tips found
at http://www.fontstuff.com/access/acctut08.htm to help me set it up.
Only,
when I get to step 2.3, it doesn't work. When it brings up a regular
parameter box instead of the form that I have built. Has anyone ever used
these instructions?

John Spencer said:
You cannot call a form from a query. You can call a query from a form
using
VBA on a button's click event.

Open the form
Select the employee
Press the button. In the code behind the button's click event you would
have something like

DoCmd.OpenQuery "YourQueryName"


To add the code to the button,
open the form in design mode,
Right-click on the button,
Show properties, click on the events tab,
in the OnClick event select [Event Procedure],
click on the three dots at the end and enter the code above (replace
YourQueryName and keep the quote marks).


Amy said:
Hi! I have created a small form with a combo box which I am using in
a
query. However, when I call the form from the query criteria, it is
not
bringing up the actual form that I have built. It brings up a regular
parameter box that reads exactly what was put into the criteria field
of
the
query. What am I doing wrong?

Here is what I have in the query criteria:
Forms![EmployeeParam]![cboEmployee]
 
G

Guest

Thanks John! I have reviewed all of the spelling and it is correct. I
entered the criteria using the build feature. It still doesn't seem to
recognize the form. Maybe i will need to start all over. Thanks!

John Spencer said:
In that case, check your spelling on the name of the control. If you have
spelled the name of the control one way on the form and slightly different
in the query, Access will display an input parameter box since it cannot
find what you are asking for.

Forms![EmployeeParam]![cboEmployee]
So, is the form named EmployeeParam?
Is the combobox named CboEmployee?

I've not stepped through the example, but it appears to be detailed and
correct.


Amy said:
I think maybe I haven't explained it correctly. I have used the tips found
at http://www.fontstuff.com/access/acctut08.htm to help me set it up.
Only,
when I get to step 2.3, it doesn't work. When it brings up a regular
parameter box instead of the form that I have built. Has anyone ever used
these instructions?

John Spencer said:
You cannot call a form from a query. You can call a query from a form
using
VBA on a button's click event.

Open the form
Select the employee
Press the button. In the code behind the button's click event you would
have something like

DoCmd.OpenQuery "YourQueryName"


To add the code to the button,
open the form in design mode,
Right-click on the button,
Show properties, click on the events tab,
in the OnClick event select [Event Procedure],
click on the three dots at the end and enter the code above (replace
YourQueryName and keep the quote marks).


Hi! I have created a small form with a combo box which I am using in
a
query. However, when I call the form from the query criteria, it is
not
bringing up the actual form that I have built. It brings up a regular
parameter box that reads exactly what was put into the criteria field
of
the
query. What am I doing wrong?

Here is what I have in the query criteria:
Forms![EmployeeParam]![cboEmployee]
 
G

Guest

You might try opening your form in design view and then use the build feature
to point to it. This way it shows up in the loaded forms folder. I've seen
this kind of thing before when I used forma that weren't currently loaded
when I built my query.
--
Michal Joyce
Project Management IS Analyst
Aflac - Project Management Office


Amy said:
Thanks John! I have reviewed all of the spelling and it is correct. I
entered the criteria using the build feature. It still doesn't seem to
recognize the form. Maybe i will need to start all over. Thanks!

John Spencer said:
In that case, check your spelling on the name of the control. If you have
spelled the name of the control one way on the form and slightly different
in the query, Access will display an input parameter box since it cannot
find what you are asking for.

Forms![EmployeeParam]![cboEmployee]
So, is the form named EmployeeParam?
Is the combobox named CboEmployee?

I've not stepped through the example, but it appears to be detailed and
correct.


Amy said:
I think maybe I haven't explained it correctly. I have used the tips found
at http://www.fontstuff.com/access/acctut08.htm to help me set it up.
Only,
when I get to step 2.3, it doesn't work. When it brings up a regular
parameter box instead of the form that I have built. Has anyone ever used
these instructions?

:

You cannot call a form from a query. You can call a query from a form
using
VBA on a button's click event.

Open the form
Select the employee
Press the button. In the code behind the button's click event you would
have something like

DoCmd.OpenQuery "YourQueryName"


To add the code to the button,
open the form in design mode,
Right-click on the button,
Show properties, click on the events tab,
in the OnClick event select [Event Procedure],
click on the three dots at the end and enter the code above (replace
YourQueryName and keep the quote marks).


Hi! I have created a small form with a combo box which I am using in
a
query. However, when I call the form from the query criteria, it is
not
bringing up the actual form that I have built. It brings up a regular
parameter box that reads exactly what was put into the criteria field
of
the
query. What am I doing wrong?

Here is what I have in the query criteria:
Forms![EmployeeParam]![cboEmployee]
 

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