Using VBA to Close Form After Requery

It still comes up with a syntax error.
 
I was editing the post, try again.
 
The edits don't result with a syntax error, thank you.

The result, when clicking the button is a window that says:

"previously un-tapped, and therefore silent error: 2450 Microsoft Access cannot find the referenced from 'ZooMobile Education Update Form'."

Which is basically the same thing as what Access pops out if I comment out the On Error line, correct?
 
Alright, I solved the problem in a MUCH simpler manner. I scrapped the entire requery in the New Facilitator Form and went back to the FacilitatorSubform in the ZooMobile Education Update Form. I then put the following:

Code:
Private Sub DocentTxt_GotFocus()

    Me.DocentTxt.Requery
    
End Sub

I got what I needed--after entering a new facilitator and going back to the combo box in the subform, the row source query is refreshed.

Thank you all for your help. It was getting way too complicated, though, so I tried an entirely different technique. And perhaps that is exactly what Cronk was suggesting in post 7. If so, thank you Cronk.
 
One way to confirm the references would be to

With the [ZooMobile Eduction Update Form] open
  1. Add a temporary blank form and a text box to the form.
  2. If it's Properties are not showing right click on it and select Properties
  3. In the DATA tab, Control Source click on the three dots ... on the right to invoke the Expression builder.
  4. Type in: Forms![ZooMobile Eduction Update Form]!FacilitatorSubform.Form!DocentTxt

As you type it the intelliSense will tell you if your are getting it right

I just notice that Education is misspelled in ZooMobile Eduction Update Form. Could that be the problem?
 
I just notice that Education is misspelled in ZooMobile Eduction Update Form. Could that be the problem?

Lol, that probably was the problem with the query not refreshing today. I probably mistyped it when making suggested changes this morning or it was misspelled in one of the suggested codes that I copy/pasted.

It still wouldn't have solved the form not closing, though. And my current solution works and is far simpler so I am satisfied and won't be doing any more experimenting trying to get the closed button to both requery and close.

Thank you, though. That just proves the importance of manual reviewing and spell checking, I guess.
 

Users who are viewing this thread

Back
Top Bottom