473,385 Members | 1,615 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

String Variable

I have the following code and I keep getting an error.

Dim ctlTB As Control
Dim strTest as String
intGry = 12632256

For intI = 1 To 9
strA = "Forms!frmmatchplay!txtTeamAHole" & intI
strB = "Forms!frmmatchplay!txtTeamBHole" & intI
intScore1 = Eval(strA)
intScore2 = Eval(strB)

If intScore1 = intScore2 Then
intHolesEven = intHolesEven + 1
strE = "Hole Halved"
strTest = "Forms!frmMatchPlay!txtTeamAHole" & intI
Set ctlTB = strTest
ctlTB.BackColor = intGry

I am attempting to loop through intI and change the background color of
a text box "txtTeamAHole1" to Hole9

Sep 26 '06 #1
4 1389
mb******@comcast.net wrote:
I have the following code and I keep getting an error.

Dim ctlTB As Control
Dim strTest as String
intGry = 12632256

For intI = 1 To 9
strA = "Forms!frmmatchplay!txtTeamAHole" & intI
strB = "Forms!frmmatchplay!txtTeamBHole" & intI
intScore1 = Eval(strA)
intScore2 = Eval(strB)

If intScore1 = intScore2 Then
intHolesEven = intHolesEven + 1
strE = "Hole Halved"
strTest = "Forms!frmMatchPlay!txtTeamAHole" & intI
Set ctlTB = strTest
ctlTB.BackColor = intGry

I am attempting to loop through intI and change the background color of
a text box "txtTeamAHole1" to Hole9
strTest = "Forms!frmMatchPlay!txtTeamAHole" & intI
FYI appears to be same as
strTest = strA
Set ctlTB = strTest
what exactly are you trying to do here? Control = String?

--
Smartin
Sep 26 '06 #2
Yes, you would, you're setting an object variable to a string value. I
think what you mean to do is:-

Instead of
strTest = "Forms!frmMatchPlay!txtTeamAHole" & intI
Set ctlTB = strTest

do this
Set ctlTB = Forms!frmMatchPlay("txtTeamAHole" & intI)

--

Terry Kreft
<mb******@comcast.netwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
I have the following code and I keep getting an error.

Dim ctlTB As Control
Dim strTest as String
intGry = 12632256

For intI = 1 To 9
strA = "Forms!frmmatchplay!txtTeamAHole" & intI
strB = "Forms!frmmatchplay!txtTeamBHole" & intI
intScore1 = Eval(strA)
intScore2 = Eval(strB)

If intScore1 = intScore2 Then
intHolesEven = intHolesEven + 1
strE = "Hole Halved"
strTest = "Forms!frmMatchPlay!txtTeamAHole" & intI
Set ctlTB = strTest
ctlTB.BackColor = intGry

I am attempting to loop through intI and change the background color of
a text box "txtTeamAHole1" to Hole9

Sep 27 '06 #3
Thanks it worked just fine. I have never been able to find information
when to use (), [], ! or . Since I am self taught and only do this
for my enjoyment, sometimes I don't know the right terminology when
asking questions. Again, thanks for the help.
Terry Kreft wrote:
Yes, you would, you're setting an object variable to a string value. I
think what you mean to do is:-

Instead of
strTest = "Forms!frmMatchPlay!txtTeamAHole" & intI
Set ctlTB = strTest

do this
Set ctlTB = Forms!frmMatchPlay("txtTeamAHole" & intI)

--

Terry Kreft
<mb******@comcast.netwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
I have the following code and I keep getting an error.

Dim ctlTB As Control
Dim strTest as String
intGry = 12632256

For intI = 1 To 9
strA = "Forms!frmmatchplay!txtTeamAHole" & intI
strB = "Forms!frmmatchplay!txtTeamBHole" & intI
intScore1 = Eval(strA)
intScore2 = Eval(strB)

If intScore1 = intScore2 Then
intHolesEven = intHolesEven + 1
strE = "Hole Halved"
strTest = "Forms!frmMatchPlay!txtTeamAHole" & intI
Set ctlTB = strTest
ctlTB.BackColor = intGry

I am attempting to loop through intI and change the background color of
a text box "txtTeamAHole1" to Hole9
Sep 28 '06 #4
When to use (), [], ! and . isa question asked many times so you're not
alone there.

A quick search on Google should find all th info you want on this topic.

--

Terry Kreft
<mb******@comcast.netwrote in message
news:11*********************@b28g2000cwb.googlegro ups.com...
Thanks it worked just fine. I have never been able to find information
when to use (), [], ! or . Since I am self taught and only do this
for my enjoyment, sometimes I don't know the right terminology when
asking questions. Again, thanks for the help.
Terry Kreft wrote:
Yes, you would, you're setting an object variable to a string value. I
think what you mean to do is:-

Instead of
strTest = "Forms!frmMatchPlay!txtTeamAHole" & intI
Set ctlTB = strTest

do this
Set ctlTB = Forms!frmMatchPlay("txtTeamAHole" & intI)

--

Terry Kreft
<mb******@comcast.netwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
I have the following code and I keep getting an error.
>
Dim ctlTB As Control
Dim strTest as String
intGry = 12632256
>
For intI = 1 To 9
strA = "Forms!frmmatchplay!txtTeamAHole" & intI
strB = "Forms!frmmatchplay!txtTeamBHole" & intI
intScore1 = Eval(strA)
intScore2 = Eval(strB)
>
If intScore1 = intScore2 Then
intHolesEven = intHolesEven + 1
strE = "Hole Halved"
strTest = "Forms!frmMatchPlay!txtTeamAHole" & intI
Set ctlTB = strTest
ctlTB.BackColor = intGry
>
I am attempting to loop through intI and change the background color
of
a text box "txtTeamAHole1" to Hole9
>

Sep 29 '06 #5

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

Similar topics

16
by: PK9 | last post by:
I have a string variable that holds the equivalent of a DateTime value. I pulled this datetime from the database and I want to strip off the time portion before displaying to the user. I am...
7
by: al | last post by:
char s = "This string literal"; or char *s= "This string literal"; Both define a string literal. Both suppose to be read-only and not to be modified according to Standard. And both have...
23
by: Nascimento | last post by:
Hello, How to I do to return a string as a result of a function. I wrote the following function: char prt_tralha(int num) { int i; char tralha;
4
by: JohnR | last post by:
Hi all, I'm finally sick and tired of manually generating get/set properties for each private variable in a class so I'm trying to create a macro to do it. I'm stuck because I can't figure out...
2
by: HerbD | last post by:
I have a loooong debugging session behind me! I finally found the reason for the problem and now would like to know, if it is a bug in my code or not standardconformant behavour of the compiler(s) or...
21
by: phpCodeHead | last post by:
Code which should allow my constructor to accept arguments: <?php class Person { function __construct($name) { $this->name = $name; } function getName()
5
by: cameljs18 | last post by:
Converting a string variable into a string literal. How do I add the @ character in front of the string? I cannot add it when the string is created as it will affect other parts of the program. ...
3
by: Hvid Hat | last post by:
Hi I want to highlight (make it bold) a word in some text I'm getting in XML format. My plan was to replace the word with a bold (or span) tag with the word within the tag. I've found the code...
4
by: mthread | last post by:
Hi, I am using a string variable in which I do lot of appending. The only difficulty I am facing as of now is appending a integer/float value to this variable. Although I can accomplish this task...
2
by: Looch | last post by:
All, I'm trying to output but I can only get (brackets for clarity) when using the code below. How can I "break" into the query variable in the InsertName method to add the name parameter to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
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...

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.