Form for parameter query.

S

Sue

I have designed a form that will display a main form & subform in response to
a parameter entered by the user. I've designed a parameter query for that
purpose, and it works! (Thanks be to God!)

Now I'd like to tinker with it a bit more to get the following result: I'd
like to change the popup box the user uses to enter the parameter they wish
to see. The parameter may actually be one of 2 numbers. This is because the
place I work for has been transitioning from using one designation - a
4-digit number - to identify certain items, but now are beginning to use a
second designantion - an 8-digit number to identify them. Some items have
both designations, some have one, some have the other. So I'd like to have
the popup show 2 columns, one with the 4-digit number and the second with the
8-digit number.

Do I design a new form that will display this way?
If so, how do I get it to "link" to the form/subform based on the parameter
query?

Obviously I'm out of my league!

I'd appreciate any help you can offer... as always. This board - and the
MVPs who monitor it so assiduously - has been a life-saver.
 
A

Allen Browne

Sue, it sounds like it might be time to take a deep breath, and spend a
little time learning how to dynamically filter a form.

Download the example database in this article:
Search form - Handle many optional criteria
at:
http://allenbrowne.com/ser-62.html

It demonstrates how to offer several filter boxes to the user, and then
filter the form to show only the results that match the boxes where the user
entered something.

It's worth learing the technique. You can use it to offer lots of filter
options for your reports as well.
 
M

Mark

Build a pop-up form with two textboxes; one where the user can enter the 4
digit number and one where the user can enter the eight digit number. Add a
command button named "OK" to the popup form and put the following code in
the OnClick event of the button:
Me.Visible = False

Put the following in the Designation field of your query:
In the first criteria line put:
Me!NameOfPopupform!NameOf4DigitTextbox Or (
Me!NameOfPopupform!NameOf4DigitTextbox Is Null)
Right under that in the second criteria line put:
Me!NameOfPopupform!NameOf8DigitTextbox Or (
Me!NameOfPopupform!NameOf8DigitTextbox Is Null)

Put the following code in the Open even of your main form:
DoCmd.OpenForm "NameOfYourPopUpForm",,,,,acDialog
DoCmd.Close "NameOfYourPopUpForm"

When a user goes to open the main form, the popup form will open first. The
user can enter either the 4 digit number or the eight digit number or both.
When the user clicks OK, the popup form will disappear and the main form
will open to the record of the item with the 4 digit or 8 digit number or
both that was entered. BTW, if the user clicks OK without entering ewither
number, the main form will open where you can vew the records of all items.

Steve
 

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