setvalue macro form

G

Guest

I have created a form that uses a ComboBox that allows someone to select a
location. This form also has 2 buttons - OK and Cancel. Once a Location is
selected and OK is pressed, I will be using that value as criteria in a
query. Unfortunately, I can't get past the OK button.

I have a Macro Group created with the following:
-- Macro for the OK button
-- Macro for the Cancel Button
-- Macro that Opens the form
-- Macro that Closes the form

The Macro's that Opens and Cancels the form seem to work fine. The Macro
for the OK button doesn't seem to be working properly. The form allows me to
select the Location from the Combo Box, but when I click OK it doesn't do
anything. It clears the ComboBox and I have to select again. It doesn't
matter how many times that I select the Location, I have to click Cancel in
order to get out of the form. What do I need to do to get out of this loop?

Additional Information:
Form Name: SelectLoc
ComboBox Name: SelectedOffice

I currently have my Item set to [Forms]![SelectLoc]![SelectedOffice]
I currently have my Expression set to "NO"

Any help is appreciated.
 
S

Steven Britton via AccessMonster.com

U should just have your Macro in the OnClick event of the button. Then the
Macro should be OpenQuery and the [Forms]![SelectLoc]![SelectedOffice]
needs to go into the Query in the Criteria Section.

If you get lost post a follow-up
 
G

Guest

I made the changes that you suggested and it now opens the query, but the
query is blank. It doesn't look like it is pulling the SelectedOffice, so
the query comes back empty. I changed the Macro so when the OK button is
clicked, the query is opened. I am assuming that I have to do something to
save the value of the "SelectedOffice" field. I'm just not sure where to do
this.

Also... I might have an issue using the OpenQuery action in the Macro. My
end result would be to pull multiple queries into a Report as subreports.
Each subreport will use the "SelectedOffice" to pull the necessary
information. Is this possible?
 

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