473,750 Members | 2,302 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Indirect String Reference To Subform

Howdy,

I'm trying to apply color schemes to forms and subforms. I'm using a
global function to change the colors/fonts of controls. Right now it
correctly loops over the controls in the main form, what I want is
recursive behavior to format the subforms.

Here's a sketch:

Function ApplyColorSchem e(strFormName As String)
Dim actFrm As Form
Dim ctl As Control
Set actFrm = Forms(strFormNa me)

For Each ctl In actFrm.Controls
With ctl
Select Case .ControlType
'Change a bunch of things
Case acSubform
ApplyColorSchem e ("[Forms]![" & strFormName & "]![" &
..Name & "].Form")
End Select
End With
Next ctl
End Function

Which will run over all the controls properly in the main form but die
when trying to load up the subform as (for example)
"[Forms]![frmMain]![frmSub].Form" saying "Microsoft Access Can't Find
the Form"

The main problem seems to be, while this statement works:
tmpString = "frmMain"
Set actFrm = Forms(tmpString )

I cannot get this one to
tmpString = "frmMain!frmSub .Form"
Set actFrm = Forms(tmpString )

nor I can figure out how to use the string as an indirect reference:
Set actFrm = [Forms]![frmMain]![frmSub].Form 'works

tmpString = "[Forms]![frmMain]![frmSub].Form"
Set actFrm = tmpString 'doesn't work

Any help would be very much appreaciated
Sam Phillips
Nov 13 '05 #1
1 3075
Figured it out. Try looking here if you have the same problem.

http://www2.usenetarchive.org/Dir8/File983.html

Sam
Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5815
by: Hal Vaughan | last post by:
I'm not sure what the correct name for this would be. I'd think it's either an indirect reference, or a pointer, or something like that. I'm working on a program that would call a series of classes in different orders and there are times where I may add extra classes that weren't part of the original design. I'd like to be able to store a list of the classes, in the order that they are used, in a text file. Then I could have the first...
2
4244
by: Christopher Burns | last post by:
Hi all, We are using VB.NET (VS2K3), sitting on VSS6. I have sorted out a configuration problem that was preventing us from building from scratch for new developers, but now I am having a very odd references problem. Here is the scoop. I will make this brief, and if more info is needed please let me know... I don't want to ramble, as the details are vast. :) There are 3 projects involved in this issue, and it appears to be a...
0
3539
by: Eric Barr | last post by:
I saw a small number of old threads about a strange build error, but never saw a solution. I just spent about 4 hours debugging this so i hoped i could help out people who come across this problem by posting a solution. Anyway, here is what i was experiencing and how i fixed it ... The Build Error: Project '<projectname>' makes an indirect reference to assembly '<assemblyname>' which contains '<classname>'. Add a reference to...
4
2255
by: Bugs | last post by:
Hi, I wonder if anyone can help me out. I'm building a vb.net application that has a form with a panel that contains several other sub forms (as a collection of controls). What I'm wanting to do is call a generically named public sub in the top-most sub form in the panel. I have the name of the top-most form as a string (eg. g_TopForm = "frmCustomers") and I can reference the form with:
14
18047
by: mchlle | last post by:
How can I filter records of a subform that is part of a tab control? The filter works fine on the form when it is not part of the tab using this in the macro condition: !!="Today" I have a main form with a tab control which has three tabs and on each tab there is a subform. Main Form: frmEmploymentVerification Tab Control Name: TabEmployment
2
4292
by: David W. Fenton | last post by:
I think at various times we've all encountered this problem: A subform is on a main form. From the code of the main form we refer to some property of/control on the child form thus: Me!subForm.Form!txtTextBox and for some reason, in certain contexts, we get the error: Error 2455: You entered an expression that has an invalid reference
5
2621
by: ApexData | last post by:
My popup form can reference the MAINFORM by using either line of the code shown below: -------------------------------------------------------------------------------- ("F-PERS").Controls("cboEduc").Requery 'My reference using hidden text boxes. (txtFormName).Controls(txtComboName).Requery --------------------------------------------------------------------------------
1
10900
by: jonathan184 | last post by:
Hi I amtrying to move over a website to another server. On the old hosting the site works fine. but when i transferred the site i am getting this error: Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Description: An error occurred during the compilation of a resource required to service...
5
9410
by: Rahul B | last post by:
Hi, I am having the following issues while trying to restrict the current user from creating any objects. Below is the privileges for the user and response when i try to create a table in that user. Can anybody tell what is the difference between DIRECT SYSADM and Indirect SYSADM and why is Indirect SYSADM is assigned to user by default.
0
8999
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8836
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9575
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9394
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9338
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
4885
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3322
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2223
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.