One form - multiple queries??

  • Thread starter Thread starter djtommye
  • Start date Start date
D

djtommye

Guest
I have a database of customers that I have created; my form for adding someone to the database is quite complex, and involves alot of code.

I would like to be able to use this same form for several queries as well, but have not seen a way to do that.

In other words, I want one form that I can populate from several different queries, when needed. How can I do this?

Thanks!
 
It's early in the morning but try this.

You can have the same form in appearence, just copy it and reference each form on the query that you require. That way it looks like it is the same form.
 
I was afraid of that. Problem is that I have quite a bit of code behind each form, and a change to one form means I have to change them all. I was kind of hoping I wouldn't have to do that.

Oh well. Thanks for confirming my fears! :-)
 
Do you have several queries that do the same thing, except they have different criteria? Perhaps you can unify them with a parameter field, or pass the criteria to the query through code.

Otherwise, it is possible to change the recordsource of a form dynamically. However if you don't have all the same fields in all your queries, you're liable to break things. I've never done it before, but I would suggest searching the Forms forum for 'chang record source' (leaving off the e makes it match change or changing).

HTH,
David R
 
Well - maybe that will work. I have a database of clients and the queries all work off of one or two fields. The result set always has the same parameters in it.

I suppose I can make one query that allows me to pass in the query type, then build on that. (Is that easy to do?- I've never passed parms to a query).

Thanks
 
Easier than you can imagine. Put the parameter in the criteria section for your field, like this: [Enter the name of the client:] or whatever your limiting field is. If it's date or number type you may have to force it into another data type than text. Search the archives for help with 'parameter quer'.

There are fancy ways to include more than one parameter in a search but only require one of them to be entered, or Query by popup form, but I've not used them. Again the archives are your friend.

Good luck,
David R
 

Users who are viewing this thread

Back
Top Bottom