chrisjames25
Registered User.
- Local time
- Today, 11:17
- Joined
- Dec 1, 2014
- Messages
- 401
Hi. I am trying to alter two things on opening of my form. One is the recordsource of the main form which i have achieved with following code:
HOwevcer i would also like to amend the subform recordsource on opening of the form however i am not having much luck here:
Any suggestion would be gratefully appreciated.
Reason i am using the StrTier1 string is i have numerous tables with simialr fields and if i can make this form work to create a form for over 10 different tables i would only need to then change the definition of StrTier1 in each one rather than make various amends to make them all releavnt for each table.
Code:
Private Function StrTier1() As String
StrTier1 = "Greenhouse"
End Function
Private Function StrTier11() As String
StrTier11 = "greenhouse"
End Function
Private Sub Form_Load()
Dim strSQL As String
Dim strSubSQL As String
strSQL = "SELECT * FROM Tbl_" & StrTier1
Me.Form.RecordSource = strSQL
Me.Txt_Tier1Bound.ControlSource = StrTier1
HOwevcer i would also like to amend the subform recordsource on opening of the form however i am not having much luck here:
Code:
strSubSQL = "Forms!frm_" & StrTier1 & "Add!frm_" & StrTier1 & "SubForm"
strSubSQL.RecordSource = strSQL
Any suggestion would be gratefully appreciated.
Reason i am using the StrTier1 string is i have numerous tables with simialr fields and if i can make this form work to create a form for over 10 different tables i would only need to then change the definition of StrTier1 in each one rather than make various amends to make them all releavnt for each table.