Run-time error on Report

VegaLA

Registered User.
Local time
Yesterday, 17:44
Joined
Jul 12, 2006
Messages
101
Hi all, trying to populate a unbound text field on a report using this code:

Me.txtPrevLC = DLookup("loancount", "tblDeptStats", "ID=98")

but I get this error message: Run-time error '-2147352567(80020009)': You can't assign a value to this object.

I have used DLookups and Dcounts for unbound textboxes on forms and have not had this error.
Is this something common? I can't find anything using search so I am hoping someone he more experienced will be able to assist me.

Thanks in advance,
Mitch....
 
Rather than referencing a control on your report in the DLookup() statement, put the value in a local variable and set the ControlSource of your report control to:
=LocalVariableName
The controls on a report are not available yet in the Open event of a report.
 

Users who are viewing this thread

Back
Top Bottom