Hello there,
I'm trying to create a report that is created dynamically when it is opened. There are 25 unbound text boxes and 25 unbound labels, named field1 - 25 and texttitle1 - 25 respectively. Each has it's 'visible' property set to false.
However, when I open it, all I get is 2 blank pages! No error appears and the query to which the report is tied to, contains data.
I guess I'm missing something.
Any pointers to a relevant post/help would be greatly appreciated.
Thanks!
Greg
Private Sub Report_Open()
Dim fieldno As Integer
Dim i As Integer
Dim addField As String
Dim addTitle As String
Dim db3 As DAO.Database
Dim rs3 As DAO.Recordset
Set db3 = CurrentDb()
Set rs3 = db3.OpenRecordset("qTempOutput"
fieldno = rs3.Fields.Count
For i = 1 To fieldno
addField = "field" & i
addTitle = "titletext" & i
Me(addField).ControlSource = rs3.Fields(i - 1).Name
Me(addField).Visible = True
Me(addTitle).Value = rs3.Fields(i - 1).Name
Me(addTitle).Visible = True
Next
Set db3 = Nothing
Set rs3 = Nothing
End Sub
I'm trying to create a report that is created dynamically when it is opened. There are 25 unbound text boxes and 25 unbound labels, named field1 - 25 and texttitle1 - 25 respectively. Each has it's 'visible' property set to false.
However, when I open it, all I get is 2 blank pages! No error appears and the query to which the report is tied to, contains data.
I guess I'm missing something.
Any pointers to a relevant post/help would be greatly appreciated.
Thanks!
Greg
Private Sub Report_Open()
Dim fieldno As Integer
Dim i As Integer
Dim addField As String
Dim addTitle As String
Dim db3 As DAO.Database
Dim rs3 As DAO.Recordset
Set db3 = CurrentDb()
Set rs3 = db3.OpenRecordset("qTempOutput"
fieldno = rs3.Fields.Count
For i = 1 To fieldno
addField = "field" & i
addTitle = "titletext" & i
Me(addField).ControlSource = rs3.Fields(i - 1).Name
Me(addField).Visible = True
Me(addTitle).Value = rs3.Fields(i - 1).Name
Me(addTitle).Visible = True
Next
Set db3 = Nothing
Set rs3 = Nothing
End Sub