C
CD
A2K
I have a simple report that shows a list of drawings and the dates we
received them as well as the Revision # of that drawing. In the
crosstab "Revision#" is the col and Drawing is the Row with
DateReceived being the value. Since I never know what the greatest
revision # I have received, I made the report dynamic with the
following code.
Private Sub Report_Open(Cancel As Integer)
On Error GoTo Report_Open_Error
Dim X As Integer
Dim Y As Integer
Dim numFields As Integer
Dim strLabel As String
Dim strFieldName As String
Dim strValue As String
Dim Z As Integer
Dim db As Database
Set db = CurrentDb
' Determine how many columns of data you will have
Y = db.QueryDefs("qryProgress_Iso_RevHistory").Fields.Count - 4
' Loop through Fields and set labels equal to Rev # and text box
equal to Date Iso Received
For X = 1 To Y
Z = X + 3
strLabel = "lbl" & X
strValue = "txtIso" & X
strFieldName =
db.QueryDefs("qryProgress_Iso_RevHistory").Fields(Z).Name
Me.Controls(strLabel).Caption = strFieldName
Me.Controls(strLabel).Visible = True
Me.Controls(strValue).ControlSource = strFieldName
Me.Controls(strValue).Visible = True
Next
Report_Open_Exit:
Exit Sub
Report_Open_Error:
MsgBox Err.Number & " " & Err.Description
GoTo Report_Open_Exit
End Sub
The code works fine. However I find that I need to have some totals.
So for Revision#1 we have 123 drawings and Revision #2 we have 32
drawing, etc. But I cannot seem to get anything to work. I am unable
to get any totals in the footers with unbound text boxes.
Does anybody have any suggestions on how to do this with code?
Thanks,
Charles D Clayton Jr
I have a simple report that shows a list of drawings and the dates we
received them as well as the Revision # of that drawing. In the
crosstab "Revision#" is the col and Drawing is the Row with
DateReceived being the value. Since I never know what the greatest
revision # I have received, I made the report dynamic with the
following code.
Private Sub Report_Open(Cancel As Integer)
On Error GoTo Report_Open_Error
Dim X As Integer
Dim Y As Integer
Dim numFields As Integer
Dim strLabel As String
Dim strFieldName As String
Dim strValue As String
Dim Z As Integer
Dim db As Database
Set db = CurrentDb
' Determine how many columns of data you will have
Y = db.QueryDefs("qryProgress_Iso_RevHistory").Fields.Count - 4
' Loop through Fields and set labels equal to Rev # and text box
equal to Date Iso Received
For X = 1 To Y
Z = X + 3
strLabel = "lbl" & X
strValue = "txtIso" & X
strFieldName =
db.QueryDefs("qryProgress_Iso_RevHistory").Fields(Z).Name
Me.Controls(strLabel).Caption = strFieldName
Me.Controls(strLabel).Visible = True
Me.Controls(strValue).ControlSource = strFieldName
Me.Controls(strValue).Visible = True
Next
Report_Open_Exit:
Exit Sub
Report_Open_Error:
MsgBox Err.Number & " " & Err.Description
GoTo Report_Open_Exit
End Sub
The code works fine. However I find that I need to have some totals.
So for Revision#1 we have 123 drawings and Revision #2 we have 32
drawing, etc. But I cannot seem to get anything to work. I am unable
to get any totals in the footers with unbound text boxes.
Does anybody have any suggestions on how to do this with code?
Thanks,
Charles D Clayton Jr