requery main form when using an ADD button.

M

Marco

Hi Everyone
Hope someone can help me. I have a form with client information at the
top that is locked and Tabpages below with the clients information. At
the top I have a Add Client Button. On the TAB1 I have a query subform
listing all my clients. I will like to click the add client button
enter the information and make it appear immediately upon closing that
popup form add the entry into the Query Subform on the first tab. I
assume I will need some type of line on exit requiring a requery? Here
is the code for the add button.

Private Sub Add_Client_Click()
On Error GoTo Err_Add_Client_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Add New Client"
DoCmd.OpenForm stDocName, , , acFormAdd


Exit_Add_Client_Click:
Exit Sub

Err_Add_Client_Click:
MsgBox Err.Description
Resume Exit_Add_Client_Click

End Sub


Best Regards
Marco
www.classactinsurance.com
 
V

Van T. Dinh

You can use the Form_Unload Event of the Form "Add New Client" to requery
the Subform on the Tab in the original Form with the statement like:

Forms!OriginalForm.SubformControl.Form.Requery

Substitute OriginalForm and SubformControl with suitable names from your
Form.

There are other Events you can use also.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top