Article ID: 143280
Article Last Modified on 1/19/2007
145777 ACC95: Microsoft Access Sample Reports Available in Download Center
175072 ACC97: Microsoft Access 97 Sample Reports Available in Download Center
Name: Quantity
ControlSource: <leave empty>
Function FillRep()
Dim rs As Recordset
Dim db As DATABASE
Set db = CurrentDb()
Set rs = db.OpenRecordset("Products", dbOpenDynaset)
rs.MoveFirst
rs.FindFirst "[ProductID]=" & Reports![Fill Report]![ProductID]
' Use this line if the function is called from report
' detail section's OnFormat property event procedure.
Reports![Fill Report]![Quantity] = rs![QuantityPerUnit]
' -or- use this line if the function is called from the
' ControlSource property of the unbound control.
FillRep = rs![QuantityPerUnit]
End Function
=FillRep()
NOTE: You can also call the FillRep() function from the ControlSource
property of the unbound Quantity text box as follows:
Name: Quantity
ControlSource: =FillRep()
If you use this method, add a comment (') in front of this line of code
in step 5:
Reports![Fill Report]![Quantity] = rs![QuantityPerUnit]
109943 How to Fill Text Boxes on a Report Using Access Basic
Keywords: kbhowto kbprogramming KB143280