Reputation: 431
I was hoping to use one form that has 3 layouts, but change the data source as the form loads. Here is the code that is called during OnLoad
Private Sub ShowInputLog(iLogType As Integer)
'Determines the Log Type Layout
'For data entry
Select Case iLogType
Case 1 '"MIPR"
Me.Caption = "MIPR"
Me.RecordSource = "tbl_MIPR"
Me.TabCodes.Pages(0).Visible = True
Me.TabCodes.Pages(0).Enabled = True
Me.cmbPR_NUM.SetFocus
Me.TabCodes.Pages(1).Visible = False
Me.TabCodes.Pages(2).Visible = False
Case 2 '"SPSPR"
Me.RecordSource = "tbl_SPSPR"
Me.Caption = "SPSPR"
Me.TabCodes.Pages(0).Visible = False
Me.TabCodes.Pages(1).Visible = True
Me.cmbPR_Contr.SetFocus
Me.TabCodes.Pages(2).Visible = False
Case 3 '"WBS"
Me.RecordSource = "tbl_WBS"
Me.Caption = "WBS"
Me.TabCodes.Pages(0).Visible = False
Me.TabCodes.Pages(1).Visible = False
Me.TabCodes.Pages(2).Visible = True
Me.cmbWBS_Num.SetFocus
End Select
End Sub
Will this work? I was hoping to see the recordsource property with my table defined, but it remains blank.
Upvotes: 0
Views: 1181
Reputation: 1485
Yes, this should work, but all tables should have displayed columns with the same names. If you have different names, create a query on each table, having identical field names, expected by the form. Such code runs on one of my Apps for 9 different queries.
Upvotes: 0
Reputation: 6336
Yes, this should work, but all tables should have displayed columns with the same names. If you have different names, create few subforms and change subform's SourceObject
property on main form depending on iLogType
Upvotes: 1