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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Field name derived from a string value returns a Run-time error 2465.



 
 
Thread Tools Display Modes
  #1  
Old May 17th, 2010, 10:43 AM posted to microsoft.public.access.forms
ab[_4_]
external usenet poster
 
Posts: 2
Default Field name derived from a string value returns a Run-time error 2465.

I have two labels on a form and want to populate them during the run
time of my form. The name of the labels are "1" the other is called
"2" (without the quotes of course). Field 1 runs OK but two returns a
run-time error 2465.
Of course, the real form is much bigger. A lot of fields called 1
through 31 are populated from within a loop. To simplify my question I
down sized this post to two label fields.

Any one know how to solve the problem with label "2"? Any help or hint
is appreciated.


' This works OK
Me![1].Caption = "abc"

' This return a Run-time error '2465': Can't find field 'x'
Dim x As String
x = "2"
Me![x].Caption = "def"

  #2  
Old May 17th, 2010, 01:12 PM posted to microsoft.public.access.forms
Jon Lewis[_3_]
external usenet poster
 
Posts: 40
Default Field name derived from a string value returns a Run-time error 2465.

Try Me.Controls(x).Caption = "def"

Jon
"ab" wrote in message
...
I have two labels on a form and want to populate them during the run
time of my form. The name of the labels are "1" the other is called
"2" (without the quotes of course). Field 1 runs OK but two returns a
run-time error 2465.
Of course, the real form is much bigger. A lot of fields called 1
through 31 are populated from within a loop. To simplify my question I
down sized this post to two label fields.

Any one know how to solve the problem with label "2"? Any help or hint
is appreciated.


' This works OK
Me![1].Caption = "abc"

' This return a Run-time error '2465': Can't find field 'x'
Dim x As String
x = "2"
Me![x].Caption = "def"



  #3  
Old May 17th, 2010, 01:55 PM posted to microsoft.public.access.forms
ab[_4_]
external usenet poster
 
Posts: 2
Default Field name derived from a string value returns a Run-time error2465.

Works! Thanks a bunch!

Cheers,
Ab


On May 17, 2:12*pm, "Jon Lewis"
wrote:
Try *Me.Controls(x).Caption = "def"

Jon"ab" wrote in message

...

I have two labels on a form and want to populate them during the run
time of my form. The name of the labels are "1" the other is called
"2" (without the quotes of course). Field 1 runs OK but two returns a
run-time error 2465.
Of course, the real form is much bigger. A lot of fields called 1
through 31 are populated from within a loop. To simplify my question I
down sized this post to two label fields.


Any one know how to solve the problem with label "2"? Any help or hint
is appreciated.


* *' This works OK
* *Me![1].Caption = "abc"


* *' This return a Run-time error '2465': Can't find field 'x'
* *Dim x As String
* *x = "2"
* *Me![x].Caption = "def"


 




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 10:25 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.