Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Pointers or Macro Substitution?
Message
General information
Forum:
Visual Basic
Category:
VBScript
Miscellaneous
Thread ID:
00362706
Message ID:
00362730
Views:
20
In VB, you would use an array for this:

Dim str(oRecordSet.Fields.Count)

Then store your values in array elements. If you want to address them by name, use a collection object
to store them, but arrays are the fastest component in VB..


>Is it possible to work with pointers (a la macro substitution in VFP) in VBScript? I'm trying to create some generic scripts to handle data processing and need this ability. As an example:
>
>I want to loop through the Fields collection of a recordset. For each item in the Fields collection, I want to programmatically create a variable by prepending "str" to Fields.Name. Then I want to assign that variable the Fields.Value property. In VFP, it would look like:
>
>oConnection = CreateObject("adodb.connection")
>oConnection.Open("Source")
>
>oRecordSet = CreateObject("adodb.recordset")
>oRecordSet.Open("Select * From Plan!Inhouse Order By Latiname", oConnection)
>
>For Each Item In oRecordSet.Fields
> strTemp = "str" + Item.Name
> * Substitute the value of strTemp and assign the fields value
> &strTemp = Item.Value
>EndFor
>
>At this point, I would have a set of variables available to me with the proper value assigned. Any help or ideas are as always appreciated.
>
>TIA, Bill
Previous
Reply
Map
View

Click here to load this message in the networking platform