I have another one of those "head scratchers". I have Form1 that I enter criteria for a query on. As I enter the different criteria fields, SubForm1 on Form1 lists records that fit the criteria. Everything is good so far. To change a record, I click on the record in SubForm1 and Form2 for editing a single record opens. When I close Form2, I update Form1 with the following code:
Private Sub Form1_GotFocus()
Forms!Form1!SubForm1.Requery
Me.Refresh
End Sub
The record updates on Form1 correctly. I only run into a problem when I add a new record. I add a new record by clicking on the Add New Record line at the bottom of the list in SubForm1. Form2 pops up and allows me to add the record. When I close Form2, the new record doesn't show on SubForm1. It WILL display if I hit the <F5> key. I've tried the following:
Private Sub Form1_GotFocus()
Forms!Form1!SubForm1.Requery
Me.Refresh
SendKeys "{F5}"
End Sub
AND:
Private Sub Form1_GotFocus()
Forms!Form1!SubForm1.Requery
Me.Requery
SendKeys "{F5}"
End Sub
AND:
Private Sub Form2_Close()
Forms!Form1!SubForm1.Requery
Forms!Form1.Requery
End Sub
None of these have worked. Can someone tell me if my code, my event, or both are wrong?
Thanks!