Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

click to close and then requery another form

Status
Not open for further replies.

hlkelly

Technical User
Jul 11, 2003
108
US
I have a form with a drop down box but if the name does not appear, the user clicks an "add user" button to open a new form where they can enter the name. The name appears in the drop down box but the associated information is not displayed in the form. If I manually refresh the form it works great. I would like to close the "add user" form and have the underlying for automatically refresh. No code I have tried is working.

Here is my code.

Private Sub Submit_Click()
On Error GoTo Err_Submit_Click


DoCmd.Close
Forms!tcs participants!combo21.Requery

Exit_Submit_Click:
Exit Sub

Err_Submit_Click:
MsgBox Err.Description
Resume Exit_Submit_Click

End Sub
 
try this and put it before your docmd.close

Forms![tcs participants]!combo21.Requery
 
Thank you for your reply.

Still doesn't work. I'm sure it is b/c of the combo21 reference. I actually need the combo to refresh AS WELL as the whole form. Combo 21 is unbound and the rest of the form displays each participants information when selected. How do I force a whole form refresh on close of the "add user" form?
 
Maybe I should add something to the unbound combo box? Here is the after_update code...maybe a form refresh based on this change as well?

Private Sub Combo21_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[GlobalID] = '" & Me![Combo21] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
 
thanks...after much searching...and a terrible migraine...this worked for me:

Private Sub Form_Close()
If Forms![tcs participants].Visible = True Then
Forms![tcs participants].Requery
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top