Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing SubForms to Pop-Ups

Status
Not open for further replies.

sabrina30

Programmer
Nov 2, 2000
31
US
I have a forms with a sub-form on it. The sub-form has 5 tabs, but a few of the forms have a lot of data in it to be entered and causes the page to be huge and requires the user to do a lot of scrolling up and down to get anything done. I would like to remove the sub-forms and put the forms into pop-ups that can be selected by pressing a button on the main form. This works fine for existing records and pulls the correct records in the forms that match the main form...I might be making this confusing and appologize if I am ...

Anyway, when I attempt to insert a new record through a pop-up form rather than using the subform it is not populating the record ID. I have the tables linked on RecordID and when using the SubForm the RecordID will populate with the RecordID that was autonumber on the Main Form. Why does it work when the forms are set as subforms, but not when I use a button to pull up the form and how can I make it work.
 
You are using DoCmd.OpenForm to open the pop up form, correct? You can pass your RecordID to the pop up form as the last parameter of the call to DoCmd.OpenForm.
Code:
DoCmd.OpenForm "PopUpForm", , , , , , txtRecordID.Value

Then, in the On Open event of your pop up form, you can access that recordID by getting "Me.OpenArgs".
 
How are ya sabrina30 . . .
sabrina30 said:
[blue]Why does it work when the forms are set as subforms, but not when I use a button to pull up the form and how can I make it work.[/blue]
When set as a subform (imbedded on a parent form) it becomes a control on the parent form. This subform control has the properties [blue]Link Master Fields[/blue] & [blue]Link Child Fields[/blue]. These properties are responsible for automatically synchronizing the subform and do not exist in stand alone forms . . .

So you have to synchronize yourself!. Perhaps this will help: faq702-5860

Calvin.gif
See Ya! . . . . . .
 
oh, that makes so much sense. Been awhile since I set up the sub-forms initially. I will check out the link provided. Thank you
 
I set everything up as suggested in FAQ702-5860, but it wants me to enter the RecordID before opening the SubForm..This was supposed to be an invisible field. I only have it visible now to make sure the correct records are being pulled. Did I do something wrong?
 
sabrina30 . . .

Since your now using the subform as a pop-up ([blue]its no longer a subform[/blue], but an independent form), [blue]did you remove the subform from the MainForm?[/blue]

If not, save the mainform under another name so you can come back to square one and remove the subform . . .

Calvin.gif
See Ya! . . . . . .
 
sabrina30 . . .

Sorry . . . the last sentence of my prior post should read:

[blue]If not, save the mainform under another name so you can come back to square one![/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top