04-27-07, 13:15 #1Registered User
- Join Date
- Nov 2005
Unanswered: Access One Form to another using same Record/recordset
I am trying to get some assistance. I have 1 database called Maintainer. I have 2 forms. I have created form1 with a continue button (for recordset maintainer) to the second form (recordset is also maintainer). How can I transition from one form the next while staying on the same record. Form1 has fields in the maintainer table and form2 has fields in the same maintainer table.
04-27-07, 13:52 #2Registered User
Provided Answers: 6
- Join Date
- May 2005
- Nevada, USA
You could use the wherecondition argument of OpenForm, but have you considered using one form instead of two, with a tab control on it to organize the fields?Paul
04-27-07, 17:33 #3Moderator
- Join Date
- Dec 2004
- Madison, WI
Hopefully your table has a unique identifier (primary key/autonumber field - i.e. called PKID or something). First, making the 2nd form a popup or a tab in the main form is a nice way of going about this (as Paul suggestions). Again, as Paul suggests, you can use the wherecondition arguement of the docmd.openform "myformname",,"[PKID] = " & Forms!mymainform!PKID & "" if opening a 2nd form. You can also make the recordsource of the 2nd form a query with criteria = Forms!mymainform!PKID. I'd make this 2nd form a popup if you're doing it this way (and also a modal).
Keep in mind that opening a 2nd form on the same recordset (table) can sometimes produce problems (especially if you deal with thousands of records and multiple users). I say sometimes. This is where you'd want to think about the design and perhaps making the fields for the 2nd form a separate table with PKID as a joined integer field. If you made the fields in the 2nd form part of a tab on the main form, you'd avoid this problem as your opening 1 form and 1 recordset verses 2 forms against the same table. Just something to think about if this is going to be a large record count database.
Lastly, if you're going about the opening a 2nd form route, make sure you've refreshed the main form before you open the 2nd form. Nothing worse than opening the 2nd form with a blank PKID on the main form. Make sure there is a visible PKID field (or whatever you named your primary key/autonumber field) which has a number in it before you open the 2nd form, otherwise you're entering records to nowheres land.
Last edited by pkstormy; 04-27-07 at 17:43.Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)
04-27-07, 17:37 #4Moderator
Provided Answers: 19
- Join Date
- Jun 2005
- Richmond, Virginia USA
Paul's suggestion makes much more sense than having two forms with the same recordset! The thing you have 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 referrencing to any contol 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 neccessary.
This is the really important part: when you go to add a control to a tabbed page, 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! There may be times when you want this to happen, however. In your case, you might want some identifying data to appear on both pages, so that you know what record you're on regardless of which page you're on.
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.
This allows you to have adequet screen room, if you will, and to divide your data entry up into logical components, with having multiple forms.
Good Luck!Hope this helps!
The problem with making anything foolproof...is that fools are so darn ingenious!
All posts/responses based on Access 2003/2007