Originally Posted by
Khalil Handal
Is it possible to use a VBA to get the values form the table or crosstab query on the open event of the report ?
Yes, of course. You can do something like this:
Code:
Private Sub Report_Open(Cancel As Integer)
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("SELECT ID, fName FROM tblNames", dbOpenForwardOnly)
With rs
While Not .EOF
Me.Controls("Label" & !ID).Caption = !fName
.MoveNext
Wend
.Close
End With
Set rs = Nothing
End Sub
Also, take a look in attachment that includes two ways: with VBA and with subreport.