PC Review


Reply
Thread Tools Rate Thread

Using a variable to refer to a control in VBA

 
 
Dale K
Guest
Posts: n/a
 
      20th May 2010
Good Afternoon,

I was wondering if any one can tell me how to fix the 3rd line to work like
the 2nd one does. The 2nd one works fine but one the 3rd one they system
throws an error.

thanks!

Dale

Dim intloop as integer
intloop=8
Forms![frmDate]![frmsubMonth].Form![subForm8].visible = False
Forms![frmDate]![frmsubMonth].Form!("subFrom" & intloop & "").visible = False


 
Reply With Quote
 
 
 
 
John W. Vinson
Guest
Posts: n/a
 
      20th May 2010
On Thu, 20 May 2010 12:25:01 -0700, Dale K <(E-Mail Removed)>
wrote:

>Good Afternoon,
>
>I was wondering if any one can tell me how to fix the 3rd line to work like
>the 2nd one does. The 2nd one works fine but one the 3rd one they system
>throws an error.
>
>thanks!
>
>Dale
>
>Dim intloop as integer
>intloop=8
>Forms![frmDate]![frmsubMonth].Form![subForm8].visible = False
>Forms![frmDate]![frmsubMonth].Form!("subFrom" & intloop & "").visible = False
>


Assuming that frmSubMonth is a Subform control, and that somewhere on that
control is a sub-subform named subForm8, try

Forms![frmDate]![frmsubMonth].Form.Controls("subForm" & intloop).visible =
False

I presume that subFrom for subForm was a typo (having made that typo many
times myself...)
--

John W. Vinson [MVP]
 
Reply With Quote
 
 
 
 
ChrisO
Guest
Posts: n/a
 
      21st May 2010
' The compiler would be typecasting so perhaps: -
"subFrom" & CStr(intloop)


--
A nod is as good as a wink to a blind horse.


"Dale K" wrote:

> Good Afternoon,
>
> I was wondering if any one can tell me how to fix the 3rd line to work like
> the 2nd one does. The 2nd one works fine but one the 3rd one they system
> throws an error.
>
> thanks!
>
> Dale
>
> Dim intloop as integer
> intloop=8
> Forms![frmDate]![frmsubMonth].Form![subForm8].visible = False
> Forms![frmDate]![frmsubMonth].Form!("subFrom" & intloop & "").visible = False
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to refer to a VBA module variable within a report select state FSHOTT Microsoft Access 3 28th Oct 2009 08:51 PM
how to refer a control in the host page from a user control if the host page using masterpage Jerry Qu Microsoft ASP .NET 1 20th Feb 2009 08:41 PM
Using a variable to refer to a control =?Utf-8?B?V2F2ZXF1YXRpb24=?= Microsoft Access VBA Modules 3 2nd Oct 2007 02:52 AM
Using a variable to refer to a control on a form. lewism@bitroads.com Microsoft Access Form Coding 1 11th May 2006 02:53 PM
Compile errors when using form control's "Control Source" property to refer to the control's value Yarik Mezheritskiy Microsoft Access Form Coding 3 5th Nov 2004 02:56 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:13 PM.