Full Version: Manipulate Single Form For Multiple Use
UtterAccess Discussion Forums > Microsoft® Access > Access Q and A
a l e x
Hello,

I have a db with many users...

Two of those users I consider Admin Users and I need to give them access to about 10 tables (for data manipulation).

The easy thing to do would be a simple docmd.opentable or docmd.openquery, but I understand how/when to use access objects and I'd like to use a form and its various properties.

My problem/question is that I do not want to create 10 new form objects in my database!

I'd like to create 1 form and set its properties to the desired specs (e.g., datasheet view, pop up, allow additions = no, etc.) and then in code manipulate its recordsource based on what recordset the user wants to work with.

What I just described is obviously pretty simple, but once I set the form's recordsource, I need to then bring in all the fields (which I've always done manually).

Is there a way to dynamically set a form's recordsource AND then add all fields into the form (since the form's view is datasheet, I don't care about how the controls are set)?

Thanks,
alex
theDBguy
Hi Alex,

What version of Access are you using? Knowing the Access version may help us determine a more appropriate response to your question.

What is the problem with creating 10 more forms in your database? I just think that the benefit of having them would outweigh any issue you may be thinking in creating them.

Unfortunately, I think when you create a form, the controls are "set" during creation. You can definitely change the source table for the form but the controls are "fixed" to the fields you used at design time.

One option you may consider (but I don't normally recommend it) is to dynamically create the form whenever you need it. But if you distribute your database as a MDE or ACCDE, then this option is not available to you.

Just my 2 cents... 2cents.gif
a l e x
Thanks for the help!

I'm using Access '03 and sometimes '10.

I could create the 10 forms, but things change so often (new tables, etc.) I just thought it would be rather cool to be able to manipulate a single form. Plus too many objects in my db tends to confuse me! I don't even like queries hanging around--I usually create/delete them in code.

You're right about the controls being set (I didn't think of that). So what you're saying is that once they're connected, they would have to be removed before any new ones were added...

I've been doing some research and you're not the only one who doesn't recommend dynamically creating forms...

Something to think about I guess.

Thanks,
theDBguy
Hi,

See if this earlier post helps.

Just my 2 cents... 2cents.gif
a l e x
I'll take a look at it...

Thanks for the help,
alex
theDBguy
Hi Alex,

yw.gif

Good luck with your project.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.