I would like to ask if anyone know the correct way for 1.changing the RecordSource in a subform
2.Refresh the subform to show the corresponding data
I have 3 subforms in a form,
Add_Company_Record_Form (Form)
Add_Company subform
(subform - add company details)
Add_Department subform
(subform - add company's department details)
Add_Assets subform
(subform - add the corresponding department's assets details for the corresponding company)
I have tried adding the following codes in the 'Add_Department subform', somehow the records shown in ' Add_Assets subform' didn't refresh to show the corresponding assets for the department chosen in the 'Add_Department subform'.
Private Sub Form_Current()
...
[Forms]![Add_Company_Record_Form]![Add_Assets subform].Form.RecordSource = query_string
[Forms]![Add_Company_Record_Form]![Add_Assets subform].Form.Refresh
...
End Sub
Notes: query_string is the SQL defined in recent codes and I think it should be alright.
I doubt whether the last line works (.Refresh)?
Can anyone help? Thx a lots in advance.
2.Refresh the subform to show the corresponding data
I have 3 subforms in a form,
Add_Company_Record_Form (Form)
Add_Company subform
(subform - add company details)
Add_Department subform
(subform - add company's department details)
Add_Assets subform
(subform - add the corresponding department's assets details for the corresponding company)
I have tried adding the following codes in the 'Add_Department subform', somehow the records shown in ' Add_Assets subform' didn't refresh to show the corresponding assets for the department chosen in the 'Add_Department subform'.
Private Sub Form_Current()
...
[Forms]![Add_Company_Record_Form]![Add_Assets subform].Form.RecordSource = query_string
[Forms]![Add_Company_Record_Form]![Add_Assets subform].Form.Refresh
...
End Sub
Notes: query_string is the SQL defined in recent codes and I think it should be alright.
I doubt whether the last line works (.Refresh)?
Can anyone help? Thx a lots in advance.