evaluating controls on a report

  • Thread starter Thread starter mcnews
  • Start date Start date
M

mcnews

i have some labels in my page header that i need to either clear or
populate within a loop. i get an error with
eval("lblVDPV" & x).Caption = "whatever"
or
eval("lblVDPV" & x & ".Caption") = "whatever"

says it can't find lblVDPV1, but of course it is there because
lblVDPV1.Caption = "whatever"
works fine.

what am i missing?

tia,
mcnewsxp
 
Based on what you posted, I don't see a need for the EVAL function. I think
all you need is:

Me.Controls("lblVDPV" & x).Caption
 
Based on what you posted, I don't see a need for the EVAL function.  I think
all you need is:

    Me.Controls("lblVDPV" & x).Caption

wow - you're right!
thanks.
 
If you were going to use Eval I think you would have to use something much
more complex. You would need to specify the Report and the control etc.

I think the entire expression would be as follows.

Eval("Reports(""NameOfReport"").lblVDPV" & x & ".Caption") = "WhatEver"


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
Back
Top