473,698 Members | 2,213 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 1185
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
2084
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
13568
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
1453
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
2658
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
2192
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
19189
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
2341
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
5088
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
8673
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
8601
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
9156
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
9021
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
8892
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
7716
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
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
5860
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3043
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

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.