how to link three forms in VBA codes

mavergara

Registered User.
Local time
Yesterday, 23:48
Joined
Jun 27, 2011
Messages
19
i have created a survey form in access with three forms, i was wondering how will I link the 3 forms to become 1 record. I put a next button every each form and submit button in the third form to create another record. but it seems its not working since the three forms are not connected to each other. Im begging for help in this please. Thanks in advance. Appreciate all your help.
 
i have created a survey form in access with three forms...but it seems its not working since the three forms are not connected to each other
I have to tell you, on the reading your post really doesn't make a lot of sense. Are all of your Forms Bound to the same Table?

Does the reason for this rather convoluted approach have to do with a 'real-estate' problem, i.e. do you have so many Controls that they cannot fit a single screen comfortably? If the answer to this is 'Yes" then the fix is probably going to be add a Tabbed Control to a single Form and spread your Controls (Textboxes, Checkboxes, etc.) over three or more Pages of the Tabbed Control. Since these Controls will all be Bound to the Fields in a single Record in your underlying Table/Query there is no need to link them together. Controls added to Tabbed Pages in this manner are all part of the single Form and are referenced as you would reference a Control on a plain, manila Form.

Here's a quick little tutorial I give people on the use of Tabbed Pages. It addresses some of the common problems experienced with them:

First thing to remember is that the Tabbed Pages are all part of a single form; think of it as a really long form turned on its side. Because it is all one form, all referencing to any control on it is done in the same manner as if they were all on one single screen. Create a form in Design View. Goto the toolbox and click on the Tabbed Control Icon; it actually looks like several manila file folders. Place it on your form and adjust the size to your liking. If you need more than the two tabbed pages it initially gives you, click on the tabbed control to select it. Goto Insert and click on Tabbed Control Page and another tabbed page will be added. Do this as many times as necessary.

This is the really important part: when you go to add a control to a tabbed page, whether it be a textbox, command button or subform, you must first click to select one of the pages, then add the control. Otherwise, the control will be added to the form itself, and will show thru on all tabbed pages! If a single page has been selected, when your cursor carrying the control appears over the page, a black "insert" will appear.

Once you have the form's Control Source (your table or a query) set up, you simple add controls as you normally would, heeding the above paragraph.

Also important to understand! If you go to move a control from one part of your main form to a tabbed page, you cannot drag and drop it! You must cut it, select the tabbed page, then paste it! And if the control has any code behind it, a GotFocus, OnClick, etc, after dropping it on the tabbed page, you'll have to "re connect" it to its code. Select the control, goto Properties, click to the right of [Event Procedure] on whatever event to bring up the ellipsis (...) then click it to go to the code window. Exit the code editor and the control and its event code will be connected.

One last thing. When trying to access the Properties of the Tabbed Control, such as the BackStyle, people complain that they can't find the property. The problem is that they haven't selected the Tabbed Control, they've selected one of the pages of the Tabbed Control! The best way to be sure of selecting the Tabbed Control itself is to click to the right of the last tab. If you have 2 tabs, for instance, click in the blank area where Tab 3 would be, if you had a Tab 3.


Now I have to add this warning; if you're talking about a truly large number of Controls here, your database may not be Normalized which is almost certainly to lead to trouble down the road for you. Most experienced developers will tell you that a single Table with more than 25-35 Fields is almost certainly not Normalized and that your data needs to be broken down into a number of logical Tables. In this case the standard approach is to have a multiple Tables and a Main Form based on one Table and Subforms based on each of the remaining Tables.

So, look over what I've posted, look over your database design and your Fields, and see if any of this makes sense to you. Post back to us what you've observed and we'll try to guide you through this.

Welcome to AWF!

Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom