473,804 Members | 3,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamic variables when looping through recordset.

1 New Member
Hi guys I what to create Dynamic variables when I loop through and recordset, I have read this forum : http://bytes.com/forum/thread436288.html

But see my problem is that so af the variables need to be an array.

Example:
Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim ObjParmArr
  3. Dim ArrayCounter
  4. Dim i
  5. Dim ParmList
  6. Dim ParmFields
  7. Set ObjParmArr = New DynamicArray
  8.  
  9. ArrayCounter = 0
  10.  
  11. SQLQuery.CommandText = "Select * from CallNatParms CNP " & _
  12.                         "INNER join Callnats CN on (CNP.CallNatID = CN.CallNatID) " & _
  13.                         "where CNP.CallNatID = 'e99be135-757a-4c22-9a59-cd3e52c47508' order by CallnateParmOrder"
  14.  
  15. OpenRecordset Recordset1,SQLQuery,3,1
  16.  
  17. If Recordset1.EOF = False Then
  18.     Do while Recordset1.EOF = False
  19.     ObjParmArr.Data(ArrayCounter) = Recordset1("ParmName") & "_" & Recordset1("ParmType") & "_" & Recordset1("ArrayLength") & "_" & Recordset1("Length")
  20.  
  21.     ArrayCounter = ArrayCounter + 1
  22.     Recordset1.MoveNext
  23.     Loop
  24. End If
  25.  
*************** *************** *************** *************** *************** ***************
Now what I need to do is if the Recordset1("Par mType") = A then the variables must be declared as an array with an lenght of the Recordset1("Arr ayLength") . exp Dim ParmName(ArrayL ength). and if the Recordset1("Par mType") = N the it is an normal dim exp. Dim ParmName.
*************** *************** *************** *************** *************** **************
Expand|Select|Wrap|Line Numbers
  1.  
  2. For i = 0 to ArrayCounter - 1
  3.     ParmFields = Split(ObjParmArr.Data(i),"_")
  4.     If ParmFields(1) = A Then
  5.         **Here I need to declare an Varibale that is an array with the size of the ArrayLength "ParmFields(3)" exp: Dim ParmFields(0) (ParmFields(3)" )
  6.     Else
  7.         **Here I need to declare an normal Varibale exp: Dim ParmFields(0) 
  8.     End IF
  9. Next
  10.  
Anyone got any idea if it is posible to do something like this?
Any help will be apriciated, or if there is an what that a can uses an two-dimencial array.
Jul 23 '08 #1
1 1879
jhardman
3,406 Recognized Expert Specialist
easiest way would be to put them in a string and use the split() function to make an array on the fly. Let me know if you need any help on the actual implementation, or if this doesn't make sense.

Jared
Jul 25 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

14
2938
by: Rahul Chatterjee | last post by:
Hello All I have an asp page in which I am performing the following 1. Querying a database view 2. Returning rows in to a recordset. 3. Looping thru the recordset and printing the data 4. Before displaying the data I am assigning the values from the recordset into variables 5. There are 2 entry points to this page both of which would run similar
7
3418
by: Jack | last post by:
Hi, I am trying to test a sql statement in Access which gives me the error as stated in the heading. The sql statement is built as a part of asp login verification, where the userid and password are input in login screen. The password in the database is a number field. I am writing the dynamic sql statement as follows below. I believe I am going wrong in the password section of the code. I appreciate any help. Thanks. Regards.
4
1721
by: cwhite | last post by:
Hi I have another drop list question. I have a table like this: computer dell computer ibm computer hp
8
1697
by: Drew | last post by:
I am trying to build a small app that shows a Course Title from the database, then displays a dropdown full of categories for the user to choose one... I thought a loop would be the best way to accomplish this, but since the dropdown is dynamic, I am having problems. Can someone help me out here? Here is my code, For i = 1 to Num
1
17684
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to Create a Dynamic Crosstab Report PRODUCT :Microsoft Access PROD/VER:1.00 1.10 OPER/SYS:WINDOWS
12
6266
by: scott | last post by:
Is there a way to create dynamic variables when looping through a recordset? For example below, after the 1st loop I'd have myVarA1 and myVarB1, after 2nd loop, I'd get myVarA2 and myVarB2. CODE *********************************** set objRS = GetMyRecordSet() i=1 objRS.MoveFirst
2
2947
by: deejayquai | last post by:
Hi I'm trying to produce a report based on a dynamic crosstab. Ultimately i'd like the report to actually become a sub report within a student end of year record of achievement. The dynamic sub-report will capture what grades the student has achieved in a list of different subjects and the reason I need it to be dynamic is that students take different subjects. Basically I've been trying to doctor the KB article on dynamic
2
30176
by: franc sutherland | last post by:
Hello, I am using Access 2003. Is it possible to use string variables in the INSERT INTO statement? I am using the INSERT INTO statement to add a long list of contacts to a group by looping through the recordset (based on a linked spreadsheet, 'tbl_group_import') and using the INSERT INTO statement on each loop. I am using the rst.Fields.Item("FieldName") method to
14
7865
ollyb303
by: ollyb303 | last post by:
Hi, I am trying to create a dynamic crosstab report which will display number of calls handled (I work for a call centre) per day grouped by supervisor. I have one crosstab query (Query1) which has the following fields: SPID (supervisor ID), total:group by, as row heading Date, total:group by, as column heading Calls handled, total:sum, as value Date, total:where, criteria between and - this is taken from a form,
0
9572
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
10562
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
10319
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
10070
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...
0
9132
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...
0
5508
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
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4282
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
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.