Hi All,
I'm having a slightly tricky problem when creating a New Record. I have a Main Form (Customers) with a SubForm (for Invoices) linked by the CustomerID field on a One to Many relationship.
The Main Customers Form, has a Command Button to create a New Record. This Control will create a new customer record for the Main Form, and a new blank record on the SubForm (Invoice). This is working well for the most part, but in certain circumstances there is a hiccup, which is causing problems. When the Command Button is clicked on the Main Customer Form, the code behind the Control includes the line:
DoCmd.GoToRecord , , acNewRec
This will then trigger the Form_Current event for the Main Form - the code runs - and everything is fine.
However, the hiccup is, that sometimes, after the Command Button code is run (which is on the Main Form) the Form_Current event for the SubForm is run first - before the Form_Current event for the Main Form. And this is causing me real problems, because I need the code in Form_Current for the Main Form to first, before the Form_Current event for the SubForm - because if it doesn't run first, errors occur.
I don't know why, DoCmd.GoToRecord , , acNewRec, (which is on the Main Form) should sometimes trigger the Form_Current event on SubForm first, but I need to ensure the correct sequence of events, but I'm at a bit of a loss at the moment.
Prof.