First, I just want to say - thanks to everyone who has helped me on my project over the last few weeks. You've been amazing and I have learned so much. When I started, I wanted to use macros exclusively because I didn't think I had the time to learn VBA. Now, I'm completely the opposite. Much prefer to use VBA over macros because the macros seem to be 1) limited and 2) unpredictable. I've made incredible progress on my own because of what I've learned here.
I have one more critical dilemma and can't figure how to solve it. I have an unbound main form with multiple subforms. In the top subform, the user can select the contract they want to view/edit. In the next subform, the details of the subform are displayed. It's kind of like a split form; datasheet view on top, single form view on the bottom. There's a third subform at the bottom listing the products associated with the selected contract. All of that works beautifully. I've even incorporated copy buttons that copy the contract or product and all the related records.
My problem is adding a new contract. Since the main form is unbound, the selector subform populates a hidden text box on the main form. I then have the details subform Parent/Child linked to that hidden control. I want the user to be able to add contracts from the same form, but I can't get a command button to work. I tried
Code:
DoCmd.GoToRecord acDataForm, "subOrder", acNewRec
in a command button (subOrder is the name of the subform where you enter the contract details), but the button errors out and says the form isn't open (clearly it is). I'm guessing the problem is the Parent/Child relationship (can't drive the Child to a record out of sync with the Parent). Is that right? If so, how do I over come that? I guess I could push the new record into the selector form, which would then cascade to the subOrder form, but I don't want users to enter new contract data in the selector form, so I have additions/edits turned off. Any thoughts?
Thanks,
Phil