Finally! I have figured out what was staring at me in the face. I was getting the error when I was loading the form. Because I have two subforms on the same main form and I have put the same code in each subform's OnCurrent event. What is happening is that the one subform is being loaded before the second. Thus when subform 1's OnCurrent event is running, subform 2 hasn't loaded yet and thus there is no Form inside the subform control. If I comment out the record move, open the form, and then uncomment the record move, it works perfectly. Now I need to come up with a way to keep my code from running when the form is opened, but still allow it to run when I'm changing records. Here are my ideas that I'm going to try:
1. Setup a global variable to act like a flag when opening the form, something like this
- intFlag = 1
-
DoCmd.OpenForm...
-
intFlag = 0
I could then test for the flag value in the forms' OnCurrent events.
2. I had an idea, but then I realized that it wouldn't work, so I guess I only have one idea so far.
If you think you have a better solution, please let me know. The main form will only be opened from one button and that button only. I will have at least one other set of subforms paired together like this on a different tab on the same main form, so I would need the solution to work for multiple connected sets of subforms.
Sorry it took me so long to get back with you on this Z. I'm only able to work on this database at work while I'm not on the clock because my mouse at home is about broke and designing a database with it requires about 10 undo clicks per change attempted :(. So I'm limited to weekends to work on this database.