A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

evaluating controls on a report



 
 
Thread Tools Display Modes
  #1  
Old July 29th, 2009, 12:50 PM posted to microsoft.public.access.gettingstarted
mcnews
external usenet poster
 
Posts: 231
Default evaluating controls on a report

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
  #2  
Old July 29th, 2009, 03:08 PM posted to microsoft.public.access.gettingstarted
Klatuu
external usenet poster
 
Posts: 7,074
Default evaluating controls on a report

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
--
Dave Hargis, Microsoft Access MVP


"mcnews" wrote:

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

  #3  
Old July 29th, 2009, 03:31 PM posted to microsoft.public.access.gettingstarted
mcnewsxp
external usenet poster
 
Posts: 83
Default evaluating controls on a report

On Jul 29, 10:08*am, Klatuu wrote:
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
--
Dave Hargis, Microsoft Access MVP

"mcnews" wrote:
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


wow - you're right!
thanks.
  #4  
Old July 29th, 2009, 04:24 PM posted to microsoft.public.access.gettingstarted
John Spencer
external usenet poster
 
Posts: 7,815
Default evaluating controls on a report

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

mcnewsxp wrote:
On Jul 29, 10:08 am, Klatuu wrote:
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
--
Dave Hargis, Microsoft Access MVP

"mcnews" wrote:
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


wow - you're right!
thanks.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:59 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.