|
-
Aug 11th, 2000, 03:46 AM
#1
Thread Starter
Member
Hi all,
I've got a program that transfers information from my datagrid to excel. It works PERFECTLY for a database of less than 40 rows. BUT more than 40 gives a 6148 runtime error!?!?!?! I'm been looking at this thing all day! HELP!
Where there's an arrow it shows what VB deems as my error.
'get total number of fields
Dim total_columns As Integer 'counter for total number of columns
Dim total_rows As Integer 'counter for total number of rows
'get total number of columns
total_columns = MY_AdoRecSet.Fields.Count
'get total number of rows
total_rows = MY_AdoRecSet.RecordCount
'Go through the X and Y axes to enter the datagrid information into the
'excel worksheet. The loop goes through the column then the next row.
Dim current_row As Integer
Dim current_column As Integer
For current_row = 1 To total_rows Step 1
----> MY_grid.Row = current_row - 1 'select the row in the grid
For current_column = 1 To total_columns Step 1
MY_grid.Col = current_column - 1 'select the column in the grid
If action = PRINTER Then
MY_xl_worksheet.Cells(current_row + Yoffset + 1, _
current_column + Xoffset).Value = MY_grid.Text
Else
MY_xl_worksheet.Cells(current_row + Yoffset, _
current_column + Xoffset).Value = MY_grid.Text
End If
Next
Next
If action = PRINTER Then
Call print_setup(MY_xl_worksheet, MY_combobox)
'Print out the Information
MY_xl_worksheet.PrintOut
End If
If action = FILE Then
If IsMissing(path) Then
MsgBox "path name not defined"
End
Else
Call saveXLS(MY_xl_worksheet, path)
End If
End If
printgrid = 0
Exit Function
-
Aug 11th, 2000, 05:09 AM
#2
Thread Starter
Member
-
Aug 13th, 2000, 10:08 PM
#3
Thread Starter
Member
Ok... well, I solved the problem, and just in case someone ever looks over this thread with the same problem, the datagrid is buggy! And assigning it a row above 28 will cause it to stay at 28. Hence if you are for looping through it, it won't get all the data from your DB.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|