Changing the table (query) to which an existing form refers

adrian.stock22

Registered User.
Local time
Today, 17:25
Joined
Mar 21, 2004
Messages
57
Changing the table (query) to which an existing form refers

Hi, All,

I have created 20 queries all based on the same table. I need 20 times the same form in order to work with each of these queries. I have created one of these forms. (Creating the form is time consuming, lots of dragging etc, and I do not want to have to repeat this task 20 times.)

Now I want to make several copies of these forms (I have made one) and want to tell each of these forms to refer to a different query table.

Where in Access can I do this? I.e. where can a change the name of the table underlying an existing form?

Thanks for your help.

Adrian
 
Just found the answer to my own question.

Go into form. Switch to design view. Click View. Click Properties.

A window appears in which I can change the underlying table and the title displayed on top of the form.

Sorry to have bothered you.

Happy Sunday.

Adrian
 
If they are identical, or close to identical, you may also consider using some code to change the recordsource of the form. Say you open them with:

docmd.openform "myform",,,,,,"nameofquery"

in the on click event procedure of a button (on a switchboard?)

i e using the openargs arguement of the openform method of the docmd object, then you can assign that in the forms on open event procedure:

if not isnull(me.openargs) then
me.recordsource=me.openargs
end if

- no need for "umpteen" forms, use the same form for all queries.
 
Adrian,

Make an "unbound" combo-box on your form. Set its RowSource to:

Code:
Select Name
From   MSysObjects
Where  Type = 5
Order By Name

Then using the AfterUpdate event of your combo:

Me.RecordSource = Me.YourCombo
Me.ReQuery

hth,
Wayne
 

Users who are viewing this thread

Back
Top Bottom