I have 5 tables that I want to allow the user to choose from, and then show records based on that table. I thought I would have just one subform and change the recordsource and textboxes /labels each time they choose one.
the SQL below is for one table from a Select (thus the End Select, ignore it for now)
If I have the main form open and the subform showing in it, it gives error can only add controls in design view.
Any ideas which is the best was to do this? Or is it better to have 5 subfoms already set up and hide them all and show which ever one they choose?
TIA
DougP
< I Built one
the SQL below is for one table from a Select (thus the End Select, ignore it for now)
If I have the main form open and the subform showing in it, it gives error can only add controls in design view.
Any ideas which is the best was to do this? Or is it better to have 5 subfoms already set up and hide them all and show which ever one they choose?
Code:
SQLCode = "SELECT [Clearance Checklist].[Project Number], [Clearance Checklist].Client, " & _
"[Clearance Checklist].Contact, [Clearance Checklist].Date " & _
"FROM [Clearance Checklist] LEFT JOIN [Clearance Checklist1] ON " & _
"[Clearance Checklist].[Project Number] = [Clearance Checklist1].[Project Number] " & _
"WHERE ((([Clearance Checklist1].[Project Number]) Is Null));"
End Select
Rs1.Open SQLCode, Conn2, adOpenStatic, adLockOptimistic
TotRecs = Rs1.RecordCount
Me.txtRecords = TotRecs
Set frm = [frmExport subform].Form
frm.RecordSource = SQLCode
For Each fldLoop In Rs1.Fields
Debug.Print fldLoop.Name
Set ctlText = CreateControl(frm.Name, acTextBox, acDetail, , fldLoop.Name, 5, 5, 30, 7)
' , "", "", intDataX, intDataY)
' Create child label control for text box.
Set ctlLabel = CreateControl(frm.Name, acLabel, , ctlText.Name, fldLoop.Name, intLabelX, intLabelY)
Next
DougP
![[r2d2] [r2d2] [r2d2]](/data/assets/smilies/r2d2.gif)