Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Dynamic Variable Names


Hello,

is there a way to build variablenames at runtime ?

For example:

We got 4 Buttons : But1,But2,But3,But4

and want to apply ReadOnly on all 4 in a loop


For i As Integer = 1 To 4

(But & i.ToString ).ReadOnly = True ' What to do here ?!

Next

Ty for your help.
DataSet




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Sql Dynamic Field Names
i have a simple query that i am going to save into a stored procedure, my problem is that i was just notified that the field might change during the course of the year

is there a way in sql to define a dynamic varible for a column heading

the column name that i am looking to make dynamic is decile.

<vb>SELECT count(*)
FROM roster
WHERE (roster.apptdate BETWEEN @startdate AND @enddate)
AND roster.meetingcode LIKE @clientcode + '%'
AND decile IN ('7', '8', '9', '10')
</vb>

this works just fine, but wont when the datqa is put under a different column called screener9 for example.

This was just a test example of something i tried, maybe im close, but i doubt that i am.

<vb>
declare @decileFieldName char(10)
set @decileFieldName = 'decile'
SELECT count(*)
FROM roster
WHERE (roster.apptdate BETWEEN @startdate AND @enddate)
AND roster.meetingcode LIKE @clientcode + '%'
AND @decileFieldName IN ('7', '8', '9', '10')
</vb>

This didn't work for me, as i expected it not to, becuase sql just check the variable above it to see if it is equal to 7,8,9,10 .

But i've been looking on the net for examples and havn't found much.

My question is: is this possible, and how can i modify my code above to do it?

TIA,
Tom

Dynamic Project Names
Is it possible to create a project in VB6 with a dynamic project name?  Say for example, you build one project kind of like a template, but use it for several EXE's

Dynamic Object-names
i actually just look for a way for letting a private sub which listbox it should change f.e.:

Code:private sub showFolders(objnumber)
a="something"
("List" + objnumber).addItem(a); <---- this is the important line
end sub

How do I make the ("List" + objnumber) work properly, so that it
uses the name "List1" if objnumber is 1, and uses "List2" if objnumber is 2, ...

thanx, caist

[ http://www.caist.com - the bright site of life ]

A Problem: Dynamic Forms Have The Same Names.
When I create forms dynamically, the new created forms have the asme names, so I can't differ them in my codes (I should set the TAG property of my forms instead the form names)

I create dynamic forms usign this method:


VB Code:
Dim frmNewForm As FormSet frmNewForm = New Form1frmNewForm.show


is there any other method to create forms with different names?
Thanks a lot

Variable Names
i posted this in the VBA section but this can also be applied to General problems... keep in mind that i am using VBA (ie i can't use index values)

OK, here is my problem: i have a form with 100 tetboxes in 10 rows and ten columns. In a previous form the user decides how many rows and columns he/she wants to have visible. The text boxes are named based on their position in the row/column. ie MM23 would be a textbox in the second column and third row. How can i use a counted loop to reference these textboxes and make the appropriate ones not visible? is there a way to use a variable in the name of the textbox? or some way of using callbyname?


ANY and all help is greatly appreciated


CN

Variable Names
Hi

I want to use the variable "currentArray". it will be set as either "numbr" or "memA" how can I use this, say in the following way:

currentArray & "sign" ="+"

so that hopefully i would get either

numbrsign = "+"
or
memAsign = "+"

so that depending on currentArray it either changes one of 2 variables,

Thanks

HR

Variable Names
Hi,

I've got a application were there are several text boxes, labelled text1, text2, text3 etc.

No what I want to do is populate these text boxes within a loop so that I don't have to repeat the same code.

Is there way in vb to to contruct the name of a variable (eg. text1) with a loop. I tried doing the following but it obviously made no sense (this is a example):

for i = 1 To 10 Step 1
"text" + i = "this box" + i
next i

If you know what I'm trying to do, could please help me out.

Thank You!

Variable Names
What is the maximum length that I can give a variable in vb?
What happens if I exceed this length?

$ And && In Variable Names
Does this have some special significance? Is it shorthand for string?
Like in something like this:

VB Code:
Function FileExists(sFileName$) As BooleanOn Error Resume Next     FileExists = IIf(Dir(Trim(sFileName)) <> "", True, False) End Function


What about "&"?

thx

Variable Names...
Hey All,

Is there a way to reference a variable name using a string? Here is an example:

I have a class with many variables labeled as follows:

Code:
ClassName.L2B1Offset
ClassName.L2B2Offset
ClassName.L2B3Offset
.
.
.
ClassName.L2B10Offset
 

Is there a way I could loop through the variable names and change the number in the variable name? For example:
Code:
For i = 1 to 10
    ClassName.L2B & i & Offset = SomeVariableValue
Next

I know this approch won't work but is there some way to accomplish the same thing??


Cyphin
~Of all the things I've lost, I miss my mind the most.~
~Iz vseh veshei chto ya poteryal, ya bol'she vsego skuchayu po rassudku.~

Help With Variable Names
simple code.
All i want it is to have bob say hi when you click button 0
and have frank say hi when you click button 1

both doen't work
{
Private Sub hello_Click(Index As Integer)

If Index = 0 Then
name = bob
ElseIf Index = 1 Then
name = frank
End If

Dim hello As New name

hello.hi

}
or
{
if index = 0 then
dim hello as new bob
end if
if index = 1 then
dim hello as new frank
end if

hello.hi
}

it works if i do a
{
dim hello1 as new bob
dim hello2 as new frank

hello1.hi
hello2.hi
}

but i need to have both of them be hello.hi
any help?

Retriving Variable Names
Hi,

Does anyone know of a method to retrieve Variable names from within a module/procedure/function etc (Im hoping for a similar method that you can use to retreive objects on a form)

Cheers in advance for any pointers in the right direction.

Creating Variable Names On The Fly
Is there any way to declare a variable name with a variable in it?

Fer instance: Dim rs & i as ADODB.Recordset

In JavaScript they call this Eval(all this stuff should be treated like code even though its a bunch of assembled stuff)

Does VB let you do this?

I'm trying to create recordsets of n-level depth for recursive data to populate a treeview control. Am I going about this stupidly?

Increasing Variable Names
Is it possible to increase a variable name? I could use a loop instead of repeating with a variable name that only has a number increased at the end.

for example:

Dim Variable1
Dim Variable2
Dim Variable3

could be (?)

Do
Dim Variable(n)
Let n = n+1
Loop until n>3

Or something like this?

If anyone knows how to do something like this or has a clue, please help me. I know its possible with a file name...

Thank you!

Danny Beaudoin (danny.beaudoin@sympatico.ca)

Using Variable Component Names
to save me from typing this :

costsheet.lbltotal1.Caption = costsheet.edtmat1.Text + costsheet.edtlab1.Text

300 times for 300 seperate components, just changing the number on the end each time, i though i could do something like this:

Dim myvar

Do Until myvar = 300
costsheet.lbltotal(myvar).Caption = costsheet.edtmat1(myvar).Text + costsheet.edtlab(myvar).Text
myvar = myvar + 1
Loop

i dont know if i'm on the right lines? i cant seem to work out how to do it

can anyone help?
thanks in advance again

Creating Variable Names
How can I create variables named from the text in a field?

Example, the user enters "price" in a text box, how could I create a variable named "price" (or whatever the user entered) that contains "9.99"?

Thanks

Using Variable Table Names In An SP
As a simplification of much more complex issue, here is roughly what I am trying to do in a Stored Procedure.

Select * from @strMyTable

(@strMyTable is a string representing the name of the table passed to the query)

I do not want the complexities of dealing with a table object and declaring table variables with definitions of columns etc when all I simply want is to refer to an arbitrary table by using the string that repesents its name .....why does it seem so complicated?

Is it just me or do other programmers find the syntactical support on the SQL 'Programming Language' aspect truly dismal - if not non-existent.
FRUSTRATING!!

Variable Form Names
Code:
Dim recloadgmform As Recordset
Dim strgmlocation As String
datselectgm.RecordSource = "SELECT GmName, GmLocation FROM tblforms WHERE GmName=" & "'" & strselectedgm & "'" & ""
datselectgm.Refresh
Set recloadgmform = datselectgm.Recordset


strgmlocation = recloadgmform![GmLocation]


'Loading Questions
With strgmlocation
.Show
.Data1.DatabaseName = App.Path & "Datadataconvert.mdb"
.Data1.RecordSource = "SELECT * From " & varlocation & " WHERE [QuestionID] = " & RandomNumber & ""
.Data1.Refresh
End With


Basically the code above doesn't work because "strgmlocation" is not an object but it doesn't work if i set it to a form instead of string. So how can I make it so when the form name is got from the database it will actually open that form. The "data1" is all the forms that can be loaded.

Variable Command Names
I'm creating a program and I have a little problem.
I have a button for every letter of the alphabet and when a button is clicked, a variable is set to that specific letter and a procedure is run.

VB Code:
Private Sub cmdQ_Click()    letter = Q    prcLetterEnd Sub

Now I want prcLetter to have a line of code that makes cmd?.Enabled = False

How do I make it so that the variable "letter" replaces the ?.

Getting Variable Names At Runtime
is something like this possible

Code:

for each variable in MyModule
Print variables<NAME> & " = " & variables<VALUE>
next

I thinking something like could be used as a memory dump in an error handler very effectively. I can think of nightmareish way to do it using constants, but I'm looking for something that is clean and tight.
thanks
kevin

Variable Object Names
Forgive me ahead of time, I'm new to this. I process several files using a VB app. Each file has a txtbox, button and label associated with it and the names of the controls include the name of the file. I want to use a variable to reference all of these things with 1 main process passing 1 value.

Current Code:
Private Sub btnPaycomm_Click()

Call Disable_Buttons
txtPaycomm.Text = "Processing Paycomm...."
lblPaycomm.ForeColor = VbRed
Call ProcessFile ("Paycomm")
txtPaycomm.Text = "Paycomm Process Completed"
Call Enable_Buttons

End Sub

Private Sub btnAccomm_Click()

Call Disable_Buttons
txtAccomm.Text = "Processing Accomm...."
lblPaycomm.ForeColor = VbRed
Call ProcessFile ("Accomm")
txtAccomm.Text = "Accomm Process Completed"
Call Enable_Buttons

End Sub

This repeats over and over for every file. There are like 50 files.

What I vision in my head but doesn't work is below: This way I write the Main Process once and just pass one file name. From all of the 50 buttons.

Private Sub btnPaycomm_Click()

Call Main_Process("Paycomm")

End Sub

Private Sub btnAccomm_Click()

Call Main_Process("Accomm")

End Sub

Public Sub MainProcess(CmdFile)

Call Disable_Buttons
"txt" & CmdFile & ".Text" = CmdFile & " Processing...."
"lbl" & CmdFile & ".ForeColor = VBRed
Call ProcessFile (CmdFile)
"txt" & CmdFile & ".Text" = CmdFile & " Process Completed"
Call Enable_Buttons

End Sub

Any help would be appreciated.

Q'n About Creating Variable Names On The Fly
hello again

just wondering how to create variable names that contain a variable

example

var1
var2
var3
var4

how would you create these names on the fly if the number was a variable?

J

i was thinking something like

dim i as integer = 0
For i = 1 To 10
dim var+(i) as string = "new variable"
next

Get Variable Names From A String
Is it possible to derive a variable name from a string? For example, you read the string "English", and you then create a variable (array) named "English". Is there anyway to do this?

Variable Names From Strings?
hey,

i'm pretty sure this cant be done, but just makin sure...

is it possible to declare and reference a variable that has a name taken from a string?

this sort of thing...

VB Code:
Dim strString as stringstrString = "varVariable"Dim [b]strString[/b] as variant

Adding Variable Names!
i have this line of code in a vb app:
Picturebox1.Picture = LoadPicture("C:MattCards" & RandomCardName & ".bmp")

i want it to load a picturefrom the file
C:MattCardsFilename.bmp

seen as this file will be randomly choen by an array and stored inthe variabe RandomCardName
now the code above looks for file
C:MattCards.bmp
can anyone solve it?? heeeeeelp!

How Can I Use A Variable For Table Names In SQL?
How can I use a string array containing many table names, such as the TableName() array below, to query different tables for each value of j%

The syntax below gives me an SQL error.
-----------

For j% = 1 To TotalTables
Set history2 = Workspaces(0).OpenDatabase(DBSelected(j%), False, False, ";pwd=;")
qry = "SELECT * FROM ' " & TableName(j%) & " ' WHERE ' " & CallFieldSelected(j%) & " ' = 'P' and '" & AvgDiffFieldSelected(j%) & "' > ' " & Threshold & " ' "
Set ArraySnap(j%) = history2.OpenRecordset(qry, dbOpenDynaset)
Next j%



--------
thx,

lp

Weird Variable Names
say i have option1, option2, option3...all the way to option10

how do i increment the variable name, i tried:

Code:
for j = 1 to 10
option[j].text = ""
next j


but that sort of thing doesnt work. ne ideas?

[Edited by Mag-Net on 07-18-2000 at 09:16 AM]

Variable Field Names
I have the floowing

Code:With rstCurr
    
        If .RecordCount > 0 Then
            
            .MoveFirst
            
            Do Until .EOF
            
                If txtNPCode = ![NPCODE] Then
                
                    .Delete
                    .MoveLast
                
                Else

I want be able define a variable field name e.g this time the field was call NPCDOE next time it may be called XYZ.

Dynamic Variable
Code:
Function SYSTEM()
Dim cLF As String
Dim fs As Object
Dim f As Object
Dim cLine As String
Dim VarCounter As Integer

cLF = Chr(13) + Chr(10)

'FSO
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("C:system.ini")


'DO WHILE....
While Not f.AtEndOfStream

cLine = f.ReadLine

If cLine = "" Then
'Message loop
MsgBox (Message & cLF & cLF & "Variablen: " & VarCounter)
GoTo readNextLine
End If

If InStr(cLine, "[") > 0 Then
Header = Replace(cLine, "[", "")
Header = Replace(Header, "]", "")
Message = Trim(Header) & cLF
VarCounter = 0
GoTo readNextLine
End If

VarCounter = VarCounter + 1[/color]

[color=Red] readArray = Split(cLine, "=")[/color]

Message = Message & cLF & cLine

readNextLine:
Wend
f.Close

'Message final
MsgBox (Message & cLF & cLF & "Variablen: " & VarCounter)
End Function

'#######################################################################
'This is the INI File

'[MAP_AND_GUIDE]
'ACTION = 3
'REQUEST = True
'OPTIMIZATION = 90
'SEQUENCEOPTIMIZATION = False
'ROUTEMAP = False
'TARGETMAP = False
'ROUTINFO = False
'MGPath=\datenmg11auftrag

' First line:
' readArray(0) = "ACTION"
' readArray(1) = "3"

' now i can call readArray(0) and i get "ACTION"
' I want to make from VALUE of readArray(0) an VARIABLE, and then call it later

'how it is:
'readArray(0) = "ACTION"
'readArray(1) = 3

'when i use
'readArray(0) = readArray(1)
'then readArray(0) = 3 AND NOT Action = 3

' I'd like to have:
'-> ACTION = readArray(1)
'-> ACTION = 3

'i thought about something like
'response.write(readArray(0)) & ("=") & readArray(1) - but this doesnt works.
' msgbox(Action) ->returns: ""

Anyone? In the Green Code is my problem described... I'd like to make from a VALUE a VARIABLE.

Possible To Create Variable Names W/ Variables?
Thanks for your help guys! I have another question
Is it possible to create names of variables with variables?
For example, I'm thinking of something like:
Dim Cstr("string" & variable) As Variant
However, this doesn't work. Is there some other syntax of method that I can use to do this?
Will, if this helps, I'm thinking of using this for a multidimentional array. Like:

Dim theBigArray() As Variant
For i=0 to something
Dim Cstr("string" & i)() As Variant
theBigArray(i)=Cstr("string" & i)()
For j=0 to something
Cstr("string" & i)(j)=j
Next j
Next i

Well this is the first time I've used multidimentional arrays so I don't even know if I'm using it right But thats basically what I'm trying to do.

Thanks in advance

Variable Names That Alter Within A Loop
I am trying to declare a variable within a loop so that its name increments on each cycle.

I have set a variable outside of the loop 'cyclingValue = 0',
but want to attach it to the end of a new variable name 'serv' to get a series of variables:
serv0=
serv1=
serv2=
....

In my low capacity brain it would look something like:


<% do while ..............

DIM (serv+cyclingValue) = whatever

cyclingValue = cyclingValue +1

<% LOOP %>

....its the DIM line and particularly the bit that I’ve stupidly put in brackets that I cant figure.

Adding To Database Using Variable Names
I'm having trouble adding a new record by using INSERT INTO.
I made a new connection, sql string (and rs) as in Loquin's code below:


Code:
Dim cn as ADODB.Connection
Set cn = New ADODB.Connection
cn.Open strConnect ' strConnect contains the connection string...
strSQL = "Insert Into YourTableName (pk_ID, Item_No, Description) Values (17, 'PART-007', 'Left Hand FooBar Retainer Clip')
cn.Execute strSQL
cn.close
set cn = Nothing

But the problem is, the values that will be sent to the database are variables. I have written the SQL string like this:


Code:
sqlstring="insert into contacts values(' " & var1 & " ',' " & var2 & " ',)"

Actually, there are about a dozen variables... but can anyone see a syntax error here? Easy to do I know, given all the quote marks and ampersands, and some variables are zero-length strings. That's not the problem - I am getting an error message saying "Syntax error in INSERT INTO statement".
I am sure the variables themselves are written OK. My main worry is with the very beginning and end of the SQL string. It starts and ends with double-quotes, which I think is kosher. What about the rest?
Many thanks.

Linking Variable Names For Output
I am trying to link 2 variables together with text to display in a "save as" input box. How can I properly link the "uid" and "currentdate" variable names with default text in between? I would like it to read "uid_currentdate_1.doc"

This is the syntax that I am using :

Default = & uid "_ " & current_date "_1.doc" ' Set default.
' Display message, title, and default value.

Thank You!!!

Basic Question About Variable Names
It must be very easy but I am not very familiar with VB. I can do this easily in Stata:

Public g1, g2, g3 as Integer

For I=1 to 3
g`I' = I*10
Next I


====
This obviously wouldn't work in VB since there is no `I' option... Basically, when I = 1, g`I' is supposed to be g1.
When I = 2, g`I' is supposed to bve g2, and so on.

Is there any way to implement this in Visual Basic?

Thank you so much for the help.

Storing Variable Names In A String
Hi Listers,

I am having a string/variable problem, which I imagine is straight forward,
but I have not been able to solve at this stage.

I am storing an sql query in an access database where the text(query)
contains a mixture of text and variables that will be populated with values
when the query is used in the app...for example

"Select" & sqlfields & " from " & thmeDataset & " where " & sqlsearchfld & "
in (" & SelListStr & ");"

anyway , the problem that I am having, is that when I read the sql query in
(in VB 6) it is all recognised as a string, so the variable names are not
replaced with the values that they hold. if I were to assign the above query
to a text variable inside the vb code, then each variable would be replaced
with the associated value...

do any of you know of a way to get around this? Do I need to make a
procedure which passes the query in and figures out what is a variable and
what is not?

thanks in advance,

Phil

Phil Bright BSc(GIS)
GIS Programmer
Demography/Population Program
Secretariat of the Pacific Community (SPC)
B.P.D5, Noumea Cedex 98848
New Caledonia
Phone (687) 26.20.00 ext(226)
Fax (687) 26.38.18
E-mail: email@removed
www.spc.int/demog



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.380 / Virus Database: 213 - Release Date: 24/07/2002

Variable Names Change When Saving
We have several developers working on the same VB code. When one user makes a line change VB will automatically change several variable names.

For example moduleName becomes ModuleName or vice versa.

From what I understand VB will find the first variable with that name and change the case on another variable with that name. The problem is that the variable names keep getting switched back and forth every time a different developer commits there changes to the code base. this means that a one line code change will actually change 200 lines of code making tracking changes rather cumbersome.

Is there anyway to control this behavior so all developers will have the same variable names.

Thanks

Robert

Use Text From INI File As Variable Names
Somebody help!

I need to dynamically create variables from the variable names and their values stored in an INI file, essentially. There are about 250 of them to create and I don't want all that to be static in my prog...not good programming.

Here is a sample from the settings file:

...
USER_NAME=UserName
USER_FNAME=FirstName
USER_LNAME=LastName
USER_PASSWORD=Password
USER_EMAIL=EmailName
USER_ID=EmployeeID
USER_PM=ProjectManager
USER_PE=ProjectEngineer
USER_PENDING=Pending
USER_DATE=Date
USER_DATENEEDED=DateNeeded
USER_JOB=Job
USER_COMMENTS=Comments
...

Where basically I need to do this

Code:Dim USER_NAME As String
USER_NAME = "UserName"


Thanks,
VBsixer

p.s. I know how to use the GetPrivateProfileSection, GetPrivateProfileString, WritePrivateProfileString stuff. It's not that. If you need more info, please post.

Variable Variable Names
I have the following code, i just want to know if theres a better way of doing it, in php i'd just do $engLabel$i but this isnt PHP its VBA which is strange and unusual

For i = 0 To rst.Fields.Count - 1
If rst.Fields(i).Name Like "Job_ID" Then GoTo skip_it1
j = j + 1


Select Case j
Case 1
Me.engLabel1.Caption = (rst.Fields(i).Name)
Case 2
Me.engLabel2.Caption = (rst.Fields(i).Name)
Case 3
Me.engLabel3.Caption = (rst.Fields(i).Name)
Case 4
Me.engLabel4.Caption = (rst.Fields(i).Name)
Case 5
Me.engLabel5.Caption = (rst.Fields(i).Name)
Case 6
Me.engLabel6.Caption = (rst.Fields(i).Name)
Case 7
Me.engLabel7.Caption = (rst.Fields(i).Name)
End Select
skip_it1:
Next

Variable Names In A Variable?
I remember doing this in Perl a long time ago, but I’ve never seen code for it in VBA…

Is it possible to reference a variable stored in another variable?
It’s difficult to explain what I’m trying to do, so I’ll just pull an example to illustrate, that probably could be solved in a different way.

Say I have 100 Integer variables and one String variable

Code:
Dim intVar1 as Integer, intVar2 as Integer, .... intVar 100 as Integer
Dim currentVar as String

I then run through a series of checks to find out what Integer variable I need to do an operation on, and store this in currentVar. Lets say I single out intVar15, and set the value of currentVar to “intVar15”.

Code:
currentVar="intVar15"
Can I now in some way change or find the value of intVar15 through currentVar?


Code:
dim currentInt as Integer

'assuming intVar15=20
'currentVar="intVar15"
currentInt = mysteryFunction(currentVar)
'value of currentInt is now 20
Possible in some way?
-Terry

Variable Variable Names
Is there a way to make a variable name.... variable?

i want to make a program that has an MDI form, with a possibility of many child forms but these must be created during runtime. i still want each form to retain individuality so i was thinking of having variable varible names so i can have something like this....

dim form(VAR) as new form1

the VAR would be a variable such as 1 or 2...
i tried doing something with the index i.e. loading and unloading indexed forms but i can't seem to find an index property for a form.

any suggestions?

CN

Variable Variable Names
Public A As String
Public B As Integer

A = "B"

I want to assign to integer, B, the value of 7 only using A.

possible something like ...

evaluate(A) = 7

where 'evaluate(A)' returns 'B', then 7 is assigned to 'B'.

:
:
:

basically I'm passing the name of a variable into a procedure, then need to assign a value to that variable. I don't know ahead of time which variable name is being passed into the procedure.

My VB buddies are stumped. PLEASE HELP. Thank you !

give, expecting nothing thereof ...

michel cazayoux

Dynamic Variable Reference
I need to reference a dynamic variable. Multi-application integration VBA in Excel.

I have variables text1 - text30. At run time the number is identified. I need to concatenate "text" & number and make that into a variable. I currenly am using case statements to load the correct variable. ie. Case 1, text1=x. Is there a better way to evalute the string and make it into a variable directly?

Thanks,

Dynamic Variable Acess...
Imagine I have 2 user inputs, Name and Number. In the program, I have defined a variety of variables, calling them ‘varA’, ‘varB’, ‘xyz’, etc. If the user types “varB” into the Name input and “42” into the Number input, how can I convince the program that the text “varB” refers to the named variable varB, and thus assign it the value 42? Assume that using arrays or pre-designated if-then trees is not practicable, and I need dynamic access to an arbitrary set of differently-named variables. Is this possible? Thank You

Dynamic Type Variable
Hi, is there a way of dynamically indicating what the variable names are in a type. Say I have:
Type Employee
FName as string
MName as string
LName as string
Addr1 as string
(and so on)
End Type
Say these names match fields in a database table. If I later add a new field in the table (Email, for example), I want to add to the Employee type: Email as string

Is there a way to do this without opening the code again and installing updates? I know when you read a recordset, you can dynamically determine the field names.

Thanks in advance.

Loss Of Variable Names Upon Email Attachment
I'm having a problem with a word/vba form I've setup. It has a lot of text boxes, a few list boxes, command buttons etc... I'm not allowing the user that is entering the form to save it at all. At the end of the form is a command button to email it to a recipient. When they click the email button it checks to make sure they filled it out properly and if they did, it attaches the form to an outlook email. The problem is that when the recipient gets the email and opens it up, most, if not all, of the variable names have gotten mixed up with one another or even completely lost. Any ideas on what the issue is here?
Thank you.

MSAccess Change Variable Names Across Objects
Is there a way in Access 2000 to change a variable/field name across all objects?

Specifically, I must rename one of my fields in a table. This field is referred to in SQL only queries, forms, macros and reports. Is there a way that I can Find and Replace ALL instances where that text string is found in all the objects?

RESOLVED: Referring To Variable Names With Concatenation
Hi, im looking for the easiest way to refer to a variable using concatenation of strings. What I'm about to write isn't exactly what's in my program but it's close enough for explanation purposes.
Let's say for example that i have 2 boolean arrays, called A1(1 to 5) and A2(1 to 5). I want the user to type either "1" or "2" into a textbox to decide which variable we're changing and then click a button to set that all the elements in that variable to true. I was hoping to write code that was something like this:

VB Code:
Private Sub Command1_Click()     For i = 1 to 5          "A" & Text1.text(i) = true     Next iEnd Sub
First it puts the "A" at the start, then adds on the number to complete the name of the variable, then obviously i is just the number to loop through all of the elements. And in case you're wondering, the "A" at the start of the variable name is necessary. In my actual program i have A1-A9, C1-C9 and M1-M9 to name a few.
Any help is greatly appreciated, as i can't get my program much further without this step.
Thanks in advance.

Passing Object Variable Names Between Forms
I want to be able to pass the name of a textbox object (i.e. myTextBox) into some kind of global variable (i.e. myGlobalVar) so I can use the global variable (i.e. myGlobalVar.Text) on a different form. Any ideas ????


If ye don't know if that's possible, does anyone know how to solve this one??

I have a form (form1) that when a button on form1 is pressed it opens another form (form2). I want the form1 function to do a wait or sleep till form2 closes/unloads and then form1 function can wake up and continue on executing.

SHELL Command && Variable Path Names
Trying to get a variable in the path of the SHELL command, here is what I have tryed!

Private Sub cmdLive_Click()

'THIS DOES NOT WORK WHERE frmJobNumber.JobNumber IS 'A VARIABLE

'LivePath = frmJobNumber.JobNumber & midpath & ' 'frmJobNumber.JobNumber & "kfslive.rpt"
'RetVal = Shell("O:WINNT
otepad.EXE livepath", 1)


'THIS DOES WORK BUT "21630" IS TO BE A VARIABLE

RetVal = Shell("O:WINNT
otepad.EXE C:ProdKFS21630dat21630kfslive.rpt", 1)

End Sub

Copyright © 2005-08 www.BigResource.com, All rights reserved