Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameters in a Form with Subform

Status
Not open for further replies.

achiola

MIS
Apr 26, 2001
44
US
I put a subform in a form. Both the form and subform draw their information from the same Query. I set parameters in the Query, and now when I open my form(which has a subform) it prompts me to put the parameters in twice. I imagine this is because it is looking for the Form and Subform seperately. I had it working just fine earlier, but I have been changing some properties around and now it does this. Can any tell me how to Fix this?

Nino
 
Do you have a field that is not in the query? This will cause a prompt, the same thing if you renamed it. If you have a field that is both in the form and the subform, you will notice in the query it will say fieldx.table a and field x.table b. If you subform field is named fieldx, you will be prompted, because the information is actually from fieldx.table b
hope this helps.
-Smack
 
All my fields are in the Query. What is happening is that I am being prompted twice with a request for the same parameter when I open the form. I might have done this wrong, but what i did was use the same Query for the subform as in the main form. So information for the main form and the subform are coming from the same Query with the same parameter. If I don't answer one of the prompts then the subform won't show anything. I hope this makes sense.

Nino
 
Does your subform have to get it's info from the query, or can you just take it directly from the table?
-Smack
 
Nino:

You are being prompted twice because each iteration of the query (one for the main form and one for the sub) causes the prompt to display.

Try this. Make a copy of the query and remove the criteria. Then make the record source of the sub form the new query.

This should eliminate the double prompt.

Just curious as to why you are using a sub form based on the same record source as the main. Are you filtering the subform based on some criteria from the main?

HTH.
Larry De Laruelle
larry1de@yahoo.com

 
Larry,

I did exactly what you suggested. Now the subform works just fine. For some reason I was trying to find a way around that. But the form is now doing what I want it to do, now that I have created the new Query.

To answer your question why I am creating the subform based on the same record source? As you thought, I am filtering the subform based on 3 different criterias from the main form(same record source). Is there a better approach?

Nino
 
Nino:

Wihtout knowing more about what you're trying to do I couldn't make any design suggestion. But, programming and database design is all in the eye of the beholder. If it works, that is what really matters.

Of course, there are ways that are more efficient and design methods that should generally be followed. As you work with Access more you'll develop your own preferred methods. I've been doing serious database development with Access for almost two years and it seem that the more I learn the more I find I need to know.
Larry De Laruelle
larry1de@yahoo.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top