F.Y.I.
Well, I think I cracked this one. First I created an unbound subform (ctrlSubForm) onto Form1 in design view using drag and drop from the tool bar. Second, I created two blank forms, one for the background (sbfrmBackGround) and one for the record entry rows (sbfrmRecEntry). Sorry for its length.
I entered the following code on to Form1 Class_Module:
********** Begin Code ********************
Option Compare Database
Dim row As Integer, rows As Integer
Private Sub Form_Open(Cancel As Integer)
ctrlRecEntry.SourceObject = "sbfrmBackGround"
End Sub
Private Sub cmdAddRec_Click()
'set subform to blank back ground
ctrlRecEntry.SourceObject = "sbfrmBackGround"
'open record subform in design view to create and format controls
DoCmd.OpenForm "sbfrmRecEntry", acDesign, , , , acHidden
'call row creation sub
'row and rows are predetermined by user
Call insertRecRow(row, rows)
'close and save record subform
DoCmd.Close acForm, "sbfrmRecEntry", acSaveYes
'reset subform source object to record subform
ctrlRecEntry.SourceObject = "sbfrmRecEntry"
End Sub
Private Sub insertRecRow(row As Integer, rows As Integer)
Dim top As Integer, a As Byte, txtbox As Control, strsql As String
'set sql for retreival of data for combo box
strsql = "SELECT * FROM OUTAGE_INFO ORDER BY OUTAGE_DESC"
'create unbound text and combo boxes for record entry rows
top = row * 240
For a = row To rows
'create and format *a* number of rows
Set txtbox = CreateControl("sbfrmRecEntry", acTextBox, acDetail, "", "", 45, top, 620, 240)
With txtbox
.Name = "txtFC" & a
.TextAlign = 2
.Format = "###0"
End With
Set txtbox = CreateControl("sbfrmRecEntry", acTextBox, acDetail, "", "", 660, top, 620, 240)
With txtbox
.Name = "txtATM" & a
.TextAlign = 2
.Format = "###0"
End With
Set txtbox = CreateControl("sbfrmRecEntry", acTextBox, acDetail, "", "", 1260, top, 840, 240)
With txtbox
.Name = "txtWorkofDate" & a
.TextAlign = 2
.Format = "mm/dd/yyyy"
End With
Set txtbox = CreateControl("sbfrmRecEntry", acTextBox, acDetail, "", "", 2100, top, 840, 240)
With txtbox
.Name = "txtResolvedDate" & a
.TextAlign = 2
.Format = "mm/dd/yyyy"
End With
Set txtbox = CreateControl("sbfrmRecEntry", acComboBox, acDetail, "", "", 2940, top, 1080, 240)
With txtbox
.Name = "cboOutage" & a
.RowSourceType = "Value List"
'populateList(variable as string) - external function to populate combo box value list
.RowSource = populateList(strsql)
.BoundColumn = 1
.ColumnCount = 2
.ColumnWidths = "0;1080"
End With
Set txtbox = CreateControl("sbfrmRecEntry", acTextBox, acDetail, "", "", 4042, top, 840, 240)
With txtbox
.Name = "txtResearchItem1" & a
.TextAlign = 2
End With
Set txtbox = CreateControl("sbfrmRecEntry", acTextBox, acDetail, "", "", 4860, top, 840, 240)
With txtbox
.Name = "txtResearchItem2" & a
.TextAlign = 2
End With
Set txtbox = CreateControl("sbfrmRecEntry", acTextBox, acDetail, "", "", 5699, top, 840, 240)
With txtbox
.Name = "txtResearchItem3" & a
.TextAlign = 2
End With
Set txtbox = CreateControl("sbfrmRecEntry", acTextBox, acDetail, "", "", 6540, top, 840, 240)
With txtbox
.Name = "txtDocItem1" & a
.TextAlign = 2
End With
Set txtbox = CreateControl("sbfrmRecEntry", acTextBox, acDetail, "", "", 7380, top, 840, 240)
With txtbox
.Name = "txtDocItem2" & a
.TextAlign = 2
End With
Set txtbox = CreateControl("sbfrmRecEntry", acTextBox, acDetail, "", "", 8219, top, 840, 240)
With txtbox
.Name = "txtDocItem3" & a
.TextAlign = 2
End With
Set txtbox = CreateControl("sbfrmRecEntry", acTextBox, acDetail, "", "", 9060, top, 840, 240)
With txtbox
.Name = "txtDocItem4" & a
.TextAlign = 2
End With
Set txtbox = CreateControl("sbfrmRecEntry", acTextBox, acDetail, "", "", 9900, top, 840, 240)
With txtbox
.Name = "txtDocItem5" & a
.TextAlign = 2
End With
Set txtbox = CreateControl("sbfrmRecEntry", acTextBox, acDetail, "", "", 10739, top, 840, 240)
With txtbox
.Name = "txtScore" & a
.TextAlign = 2
.Format = "##0"
End With
'set next rows top position
top = top + 240
Next a
End Sub
********** End Code ********************
ERM