Home > Software engineering >  Beginners, urgently needs to solve the problem of array, very urgent, please speed to save!
Beginners, urgently needs to solve the problem of array, very urgent, please speed to save!

Time:10-07



As is shown in

Dynamic two-dimensional array, first to define a number of lines is based on a single borrower, the column is not null judgments, whereas the number of columns in red circle part to 9 columns per ~

Then to cycle to form corresponding to each row circle in the current column data assign values to the definition of two-dimensional array,
How to write code, please?

CodePudding user response:

In VB6, if changing the multi-dimensional dynamic array size,
Need to keep the previous data, can only change the size of the final d,
According to your applications, data rows are dynamic,
That the two dimensional array should be defined like this:
Dim arrData () as string
.
ReDim arrData (columns and rows)
Here "column" for 8 (0 ~ 8, a total of nine column number)
And "line" can, as required for dynamic change,

CodePudding user response:

What conditions? If it is "form" of the environment, directly from the form number is more convenient?

CodePudding user response:

refer to the second floor Topc008 response:
what? If it is "form" of the environment, directly from the form number is more convenient?

Not necessarily, he 9 columns of data, is not continuous,
Processing data in the circulation is not so convenient,
In addition, if in the process of data processing to frequent, speaking, reading and writing,
Direct operation forms, a much slower speed,
"Written", in particular, the corresponding areas are references to other formula,
If the data is more, will cost a very long time,

CodePudding user response:

CodePudding user response:

Tabular data is where come of? Is from the database table?

If it is, to execute an SQL query, and then the record set directly into the array,

CodePudding user response:

Dim arrLoan As the Variant
Dim cn As New ADODB library. The Connection, the rs As New ADODB. You

Cn. Open "... "
Rs. OPen the "Select the approved amount, cash course, correspondence course, borrowers, lenders, note, recognition, the cash account code, correspondence course code From yourTable Where Not IsNull (borrowing form)", cn

ArrLoan=rs. GetRows

Rs. Close
Set the rs=Nothing
Cn. Close
The Set cn=Nothing

CodePudding user response:

In the tabular data from myexcel, actually can also be understood as is the SQL data table from it, but I have to implement the data summary yao is now displayed in the excel operation the data in the table and then in another table in the database data

CodePudding user response:

Myexcel is Excel object?
Is: the total row can fill SUMIF formula,
No: SQL combined using the SUM function is more convenient,

CodePudding user response:

May be misunderstood, myexcel is a by excle bearing developed good program, rather than the object,,

CodePudding user response:

As long as it is Excel, can fill in the formula,
Can be specified in the design templates, can be in the object (if any) in the operation,

CodePudding user response:

Estimates that you understand the wrong I mean
My final meaning to obtain current data in the excel spreadsheet and then create a 2 d array and the current data stored in each row in the
Grouping and summary data summary of field for the approved amount, other fields as shown

CodePudding user response:

Use Excel as an external database, SQL query,

CodePudding user response:

refer to 12 floor of123 reply:
Excel as external database, use the SQL query,

That's it.

CodePudding user response:

Define a n line 11 column 2 d array, the cash account code, correspondence course code read 10, 11 columns can
 Sub Test () 
Dim arr
Arr=[d9]. Resize ([b9]. End (4). The Row - 8, 11)
End Sub
  •  Tags:  
  • VBA