473,463 Members | 1,536 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Form Addressing from variable

I want to do this from a for/next loop:

DoCmd.OpenForm aryForm2(count), acDesign, , , , acWindowNormal
Temp = aryForm2(count)
Forms!Temp.Section(1).BackColor = Forms!zfrmcolor!color2

The compiler doesn't understand I want to use the variable 'Temp'
instead of a form named "Temp".

How do I get around this?

------

Current code is:

Private Sub cmdColorize_Click()
Dim aryForm2(0) As String
aryForm2(0) = "frmqunioncomp"

Dim frm2end As Integer
Dim count As Integer
Dim temp As String

For count = 0 To UBound(aryForm2)

DoCmd.OpenForm aryForm2(count), acDesign, , , , acWindowNormal
Temp = aryForm2(count)
Forms!Temp.Section(1).BackColor = Forms!zfrmcolor!color2

Next
End Sub
------

Dec 13 '06 #1
3 1509
Try:
Forms(aryForm2(count)).BackColor = ...

Item is the default collection for forms, so it's an abbreviation of this
kind of construct:
Forms.Item("Form1")

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<ch************@yahoo.comwrote in message
news:11**********************@f1g2000cwa.googlegro ups.com...
>I want to do this from a for/next loop:

DoCmd.OpenForm aryForm2(count), acDesign, , , , acWindowNormal
Temp = aryForm2(count)
Forms!Temp.Section(1).BackColor = Forms!zfrmcolor!color2

The compiler doesn't understand I want to use the variable 'Temp'
instead of a form named "Temp".

How do I get around this?

------

Current code is:

Private Sub cmdColorize_Click()
Dim aryForm2(0) As String
aryForm2(0) = "frmqunioncomp"

Dim frm2end As Integer
Dim count As Integer
Dim temp As String

For count = 0 To UBound(aryForm2)

DoCmd.OpenForm aryForm2(count), acDesign, , , , acWindowNormal
Temp = aryForm2(count)
Forms!Temp.Section(1).BackColor = Forms!zfrmcolor!color2

Next
End Sub
------

Dec 14 '06 #2
call the string variable something else?

some folks would hang you for not calling them StrTemp and FrmTemp in the
first place

<ch************@yahoo.comwrote in message
news:11**********************@f1g2000cwa.googlegro ups.com...
>I want to do this from a for/next loop:

DoCmd.OpenForm aryForm2(count), acDesign, , , , acWindowNormal
Temp = aryForm2(count)
Forms!Temp.Section(1).BackColor = Forms!zfrmcolor!color2

The compiler doesn't understand I want to use the variable 'Temp'
instead of a form named "Temp".

How do I get around this?

------

Current code is:

Private Sub cmdColorize_Click()
Dim aryForm2(0) As String
aryForm2(0) = "frmqunioncomp"

Dim frm2end As Integer
Dim count As Integer
Dim temp As String

For count = 0 To UBound(aryForm2)

DoCmd.OpenForm aryForm2(count), acDesign, , , , acWindowNormal
Temp = aryForm2(count)
Forms!Temp.Section(1).BackColor = Forms!zfrmcolor!color2

Next
End Sub
------


Dec 14 '06 #3

Allen Brown wrote:
Try:
Forms(aryForm2(count)).BackColor = ...
Item is the default collection for forms, so it's an abbreviation of this
kind of construct:
Forms.Item("Form1")
OMG - it worked!

Thanks Allen! You just saved me a ton of time and code!
- Christian

Dec 14 '06 #4

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

Similar topics

12
by: Frank Stephan | last post by:
Hi, im using Struts with nested tags for form validation. So I end up with form elements named like this risikenManuell.praemieNeu risikenManuell.praemieNeu .... I would like to do a...
1
by: Jimbo | last post by:
Hi people, I am playing with the WSE 2.0 SP3 and am trying to get use the ReplyTo WS-Addressing header to send a response to a different machine than where the request came from. However, in my...
9
by: MM | last post by:
Hi, I was taught to use this type of class/member construction (some years ago I might add) - class someclass { private datatype data1; private datatype data2;
0
by: Stefan Lischke | last post by:
Hi, I'm really desperate using code generation(wsdl.exe) from wsdl files for latest WS-Eventing(including WS-Addressing) Specs. I'm writing my diploma about "publish subscribe systems based on...
7
by: Hank | last post by:
My boss wants to be able to set the background color of all forms to one color that he selects on our Configuration form.. I'd rather not add a function to every form I have and wondered if it...
2
by: Vinny | last post by:
A customer wants me to convert a VB app I wrote for them into a web app for remote users to do data entry. So, I'm writing a small ASP program which prompts the user for data, much like a VB...
2
by: Alan | last post by:
I have created a class library say, EmployeeDataDLL.dll. This is a data access to the backend database. How do I create an object of the class inside this dll from a Windows form ?
0
by: gerritmitchell | last post by:
Hi, I have a situation where I need to send a SOAP message from a receiver through multiple intermediaries and then to an ultimate receiver. The intial sender will tell the intermediary where...
1
by: =?Utf-8?B?dWx0cmFuZXQ=?= | last post by:
We have a client that uses .Net that needs to work against our Java (xfire) based WS. My question is: how can a .Net (C#) WS client be configured to not send WS-Addressing headers? The client in...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
1
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.