how do i get my forms to update

  • Thread starter Thread starter ngozi
  • Start date Start date
N

ngozi

Guest
i have a form with 3 tabs(client, advice,casework). Relationship wise,the client table has a 1:m and 1:1relationshhip with the advice and casework table respectively.
case work has a i:m relationship with a table called subcase work. as a result i have put a command button on the casework form(situated within the casework tab) to open up the subcaswork form

The client,advice and casework forms updates fine when i enter information but when i enter information into subcasework form, i find that the info' i put into it dissapears (i.ewhen i go back into) however the underlying tables are updating.

i have checked the properties for the subcasework form and 'data entry' is set to no and all the allow options are set to yes.

Also if this helps, the caswork form is set a a single form and when the command button is clicked it opens up into the subcasework form which i have set as continuous can anyone help :confused:
 
Post a copy of your database and let us see what you are deailing with. Will be a lot easier to implement than to explain.
 
Without seeing your database and understanding what you are doing is a little difficult, but I'll give it a go.

Assuming you have a form with tabs and sub forms in each tab. (we'll call the parent Form frmClients, for reference below)
When you open a Pop Up form and enter data, you need to remove the close button from the properties box and create an OK button.

A Cancel button might be nice as well.

Code:
Private Sub Cancel_Click()
On Error GoTo Err_Cancel_Click
    
    Me.Undo
  ' It is best to name the from you are closing e.g.
  ' DoCmd.Close acForm, "frmName"     
    DoCmd.Close

Exit_Cancel_Click:
    Exit Sub

Err_Cancel_Click:
    MsgBox Err.Description
    Resume Exit_Cancel_Click
End Sub

OK Button
Code:
Private Sub OK_Click()
On Error GoTo Err_OK_Click
 ' It is best to name the from you are closing e.g.
 ' DoCmd.Close acForm, "frmName"   
    DoCmd.Close

Exit_OK_Click:
    Exit Sub

Err_OK_Click:
    MsgBox Err.Description
    Resume Exit_OK_Click
End Sub

In addition, when the form closes using the OK button, you need to tell it to requery the data in the forms that have changed when they click on the OK button.

So add in to the above OK button code before the close command
Code:
' requery the subform of the clients info that has changed
Forms![frmClients]![subfrmClientsInfo].Form.Requery

I find the easiest way to know exactly what to put in to the requery code for a form is to open the form I am requerying, then in design mode, properties of the button etc, you the expresion builder and go to forms, loaded forms and choose the field or form I want to requery, copy the code and paste it in to the code box.

Hope this helps. - I apologise if I have over simplified, just trying to make it clear.
 

Users who are viewing this thread

Back
Top Bottom