473,725 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

trying to use a variable as a part of a string....why is this


tempname = FindSpaces(rs![column 1])
this works fine but if I try to pass a variable value to it

For i = 1 To 3 Step 2
tempname = FindSpaces(rs![column (i)])

why can't the variable i just be used in this way?
Is it because of the space in the name column 1 or is
it something else?

thanks for any pointers

Jerry

Apr 5 '06 #1
3 1187
Hi Jerry

try instead

dim strName as string

For i = 1 To 3 Step 2
strname = "Column " & trim(str(i))
tempname = FindSpaces(rs.f ields(strname))
next

-Dick Christoph
"sparks" <js******@swbel l.net> wrote in message
news:ua******** *************** *********@4ax.c om...

tempname = FindSpaces(rs![column 1])
this works fine but if I try to pass a variable value to it

For i = 1 To 3 Step 2
tempname = FindSpaces(rs![column (i)])

why can't the variable i just be used in this way?
Is it because of the space in the name column 1 or is
it something else?

thanks for any pointers

Jerry

Apr 5 '06 #2
that did it thanks a lot.
but why do you have to rebuild the string, is it because of the space
in the name?

Jerry
On Wed, 05 Apr 2006 15:34:10 GMT, "DickChrist oph"
<dc********@yah oo.com> wrote:
Hi Jerry

try instead

dim strName as string

For i = 1 To 3 Step 2
strname = "Column " & trim(str(i))
tempname = FindSpaces(rs.f ields(strname))
next

-Dick Christoph
"sparks" <js******@swbel l.net> wrote in message
news:ua******* *************** **********@4ax. com...

tempname = FindSpaces(rs![column 1])
this works fine but if I try to pass a variable value to it

For i = 1 To 3 Step 2
tempname = FindSpaces(rs![column (i)])

why can't the variable i just be used in this way?
Is it because of the space in the name column 1 or is
it something else?

thanks for any pointers

Jerry


Apr 5 '06 #3
Hi Jerry

No It is because the syntax of VBA doesn't allow a variable in this context.

Given this it would expect the field name is "column (i)" which not only
isn't what you want but has nothing to do with the value of i.
tempname = FindSpaces(rs![column (i)])

-Dick Christoph
"sparks" <js******@swbel l.net> wrote in message
news:ov******** *************** *********@4ax.c om... that did it thanks a lot.
but why do you have to rebuild the string, is it because of the space
in the name?

Jerry
On Wed, 05 Apr 2006 15:34:10 GMT, "DickChrist oph"
<dc********@yah oo.com> wrote:
Hi Jerry

try instead

dim strName as string

For i = 1 To 3 Step 2
strname = "Column " & trim(str(i))
tempname = FindSpaces(rs.f ields(strname))
next

-Dick Christoph
"sparks" <js******@swbel l.net> wrote in message
news:ua****** *************** ***********@4ax .com...

tempname = FindSpaces(rs![column 1])
this works fine but if I try to pass a variable value to it

For i = 1 To 3 Step 2
tempname = FindSpaces(rs![column (i)])

why can't the variable i just be used in this way?
Is it because of the space in the name column 1 or is
it something else?

thanks for any pointers

Jerry

Apr 5 '06 #4

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

Similar topics

6
1579
by: Paul C-T | last post by:
I've read the newsgroups on this ... the PHP website and I'm still confused .... I am parsing a variable $howmany to a for / loop to print out multiple form fields with similar names ... for ($t = 1; $t < $howmany; ++$t) { print '<TR><TD>Enter field ' . $t . '</TD><TD><INPUT TYPE="text" NAME="field' . $t . '"></TD></TR>'; }
8
2089
by: Rich Grise | last post by:
I think I've finally found a tutorial that can get me started: http://www.zib.de/Visual/people/mueller/Course/Tutorial/tutorial.html and I've been lurking for awhile as well. What happened is, I've been playing with Qt in KDE on a Slackware 10.0 system, and following their cookbook exercises, and everything's working, and I have no clue what the code is doing, i.e.. how do I connect my brain to the ascii in the files to the stuff on...
4
13570
by: Augustus S.F.X Van Dusen | last post by:
I have recently come across the following construction: #define P_VAR(output, string, args...) \ fprintf (output, "This is "string"\n", ##args) which can be invoked as follows: int x = 1, y = 2 ; char * str = "String" ;
2
1458
by: | last post by:
I have gotten the following error in trying to get totals to come out on a footer. Server Error in '/test' Application. ---------------------------------------------------------------------------- ---- DataBinder.Eval: 'System.Data.Common.DbDataRecord' does not contain a property with the name ViewCount. Description: An unhandled exception occurred during the execution of the
4
2661
by: Friday | last post by:
Being an Old L.A.M.P guy, I beg you to please excuse my ignorance of dot.net (and all things Windows, for that matter). As part of an experiment (to learn enough ASP/VB.net to port a series of existing PHP scripts of mine to work on IIS), I have created the following simple function to compare a Website visitor's IP address against a varabe-array. The experiment invovleas a common scenario -- banning a Website visitor by IP Address: ...
7
2195
by: Aaron | last post by:
Complete code follows. I am new to .NET programming (and programming in general) and I am having a difficult time understanding how to fill a variable in one sub, and then access it from another. I have tried declaring them as shared, public, friend, etc and I always get an error stating that something is not valid on a local variable declaration. For example, in the following code for Sub DataGrid_Select, I have CurrentID and...
23
19199
by: Russ Chinoy | last post by:
Hi, This may be a totally newbie question, but I'm stumped. If I have a function such as: function DoSomething(strVarName) { ..... }
2
2342
by: simon | last post by:
hello, what i'm looking to do is store the path of the app on a the server for reuse in the site. my thoughts so far are... -make a key in the web.config file -retrieve the value in globals.asax in application startup -store it in a variable that can be reference from all pages -use that variable on many pages my questions 1) what is the syntax of the lines in global.asax page to put this
17
5091
by: Control Freq | last post by:
Hi, Not sure if this is the right NG for this, but, is there a convention for the variable names of a Session variable? I am using .NET 2.0 in C#. I am new to all this .NET stuff, So, any guidance appreciated. Regards
0
8752
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
9401
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
9257
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...
0
9111
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6702
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4517
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4782
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2634
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
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.