B
Bryan Hughes
Hello
I have a form for adding new clients. The form has several subforms.
Several clients can belong to a single case file, so some information is
entered once for the case file, which is shown in the subform, after it is
entered. To enter this information, I have a quick data entry form pop up.
Once the data is entered and saved, How can I requery the subform to show
the new data entered?
I have tried several things but so far no success.
Here is what I have been working with:
'************************************
'Save and Close
Private Sub cmdSave_Click()
On Error GoTo ErrorHandler
Dim frm As Access.Form
If Me.Dirty = True Then
DoCmd.RunCommand acCmdSaveRecord
End If
If CurrentProject.AllForms("frmNew_Client_Details").IsLoaded = True Then
Set frm =
Forms![frmNew_Client_Details]![fsubClient_Primary_Contact].Form
'Requery Primary Contact subform
strSearch = "[CFID] = " & Chr$(39) & _
Me![frmNew_Client_Details]![fsubClient_Primary_Contact].Form &
Chr$(39)
frm.Requery
frm.RecordsetClone.FindFirst strSearch
If frm.NoMatch Then
Debug.Print "No match Found"
Else
frm.Bookmark = frm.RecordsetClone.Bookmark
End If
End If
DoCmd.Close acForm, "fdqPrimary_Contact", acSaveNo
Exit Sub
ErrorHandlerExit:
Exit Sub
ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
Resume ErrorHandlerExit
End Sub
Please help
-Bryan
I have a form for adding new clients. The form has several subforms.
Several clients can belong to a single case file, so some information is
entered once for the case file, which is shown in the subform, after it is
entered. To enter this information, I have a quick data entry form pop up.
Once the data is entered and saved, How can I requery the subform to show
the new data entered?
I have tried several things but so far no success.
Here is what I have been working with:
'************************************
'Save and Close
Private Sub cmdSave_Click()
On Error GoTo ErrorHandler
Dim frm As Access.Form
If Me.Dirty = True Then
DoCmd.RunCommand acCmdSaveRecord
End If
If CurrentProject.AllForms("frmNew_Client_Details").IsLoaded = True Then
Set frm =
Forms![frmNew_Client_Details]![fsubClient_Primary_Contact].Form
'Requery Primary Contact subform
strSearch = "[CFID] = " & Chr$(39) & _
Me![frmNew_Client_Details]![fsubClient_Primary_Contact].Form &
Chr$(39)
frm.Requery
frm.RecordsetClone.FindFirst strSearch
If frm.NoMatch Then
Debug.Print "No match Found"
Else
frm.Bookmark = frm.RecordsetClone.Bookmark
End If
End If
DoCmd.Close acForm, "fdqPrimary_Contact", acSaveNo
Exit Sub
ErrorHandlerExit:
Exit Sub
ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
Resume ErrorHandlerExit
End Sub
Please help
-Bryan