G
Greg Crowe
I've worked with Access way too long not to know this answer to this..
We run a lot of corp reporting through various legacy access front
ends to SQL data (linked tables, all ADO code in Access 2007).
On Report.Open we bind the RecordSource object to a SQL view. I cannot
access fields in that view in VBA unless I bind said fields to a
control on the report. Is this normal? Am I missing something stupid
obvious?
Example - set RecordSource, if some condition (WorkOrderStatus) is
met, make that line gray on the report:
Private Sub Report_Open(Cancel As Integer)
Me.RecordSource = "dbo.view_Blanket_Wrap"
End Sub
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me!WorkOrderStatus = 4 Then
Me.Detail.BackColor = 12632256
Else
Me.Detail.BackColor = 16777215
End If
End Sub
This works if I bind WorkOrderStatus to a control on the report.
Additionally, none of the other fields in the SQL view
dbo.view_Blanket_Wrap are available unless bound to report objects. Am
I doing it wrong?
Regards,
- Greg Crowe
We run a lot of corp reporting through various legacy access front
ends to SQL data (linked tables, all ADO code in Access 2007).
On Report.Open we bind the RecordSource object to a SQL view. I cannot
access fields in that view in VBA unless I bind said fields to a
control on the report. Is this normal? Am I missing something stupid
obvious?
Example - set RecordSource, if some condition (WorkOrderStatus) is
met, make that line gray on the report:
Private Sub Report_Open(Cancel As Integer)
Me.RecordSource = "dbo.view_Blanket_Wrap"
End Sub
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me!WorkOrderStatus = 4 Then
Me.Detail.BackColor = 12632256
Else
Me.Detail.BackColor = 16777215
End If
End Sub
This works if I bind WorkOrderStatus to a control on the report.
Additionally, none of the other fields in the SQL view
dbo.view_Blanket_Wrap are available unless bound to report objects. Am
I doing it wrong?
Regards,
- Greg Crowe