Good afternoon. I'm trying to put a quick Progress Bar into Access and found this on "pyeung.com"
I have this code to open an Excel spreadsheet
And this code to write each cell from Excel to Access (because it's the ONLY WAY I've found to import more than 255 characters!!)
So I thought that if I obtained the row number of the final row with data in the worksheet, I could end up with something like
Unfortunately
only shows 0.
Is it possible to do what I "want" or is there an alternative simple way to create such a Progress Bar?
Many thanks,
Des.
Code:
Dim Counter As Integer
SysCmd acSysCmdInitMeter, "Updating: ", 1000
For Counter = 1 To 1000
SysCmd acSysCmdUpdateMeter, Counter
Next Counter
SysCmd acSysCmdRemoveMeter
I have this code to open an Excel spreadsheet
Code:
Set xlw = xlx.Workbooks.Open("G:\DP\Pamela\Reuters\Ben\TRCS_AMERICAS_Template.xls", , True) ' opens in read-only mode
Set xls = xlw.Worksheets("TRCS_america")
Set xlc = xls.Range("A2") ' this is the first cell that contains data
And this code to write each cell from Excel to Access (because it's the ONLY WAY I've found to import more than 255 characters!!)
Code:
' write data to the recordset
Do While xlc.Value <> ""
rst.AddNew
For lngColumn = 0 To rst.Fields.Count - 1
rst.Fields(lngColumn).Value = xlc.Offset(0, lngColumn).Value
Next lngColumn
rst.Update
Set xlc = xlc.Offset(1, 0)
Loop
So I thought that if I obtained the row number of the final row with data in the worksheet, I could end up with something like
Code:
SysCmd acSysCmdInitMeter, "Updating: ", xlEndRow
x = 1
Do While xlc.Value <> ""
SysCmd acSysCmdUpdateMeter, x
rst.AddNew
For lngColumn = 0 To rst.Fields.Count - 1
rst.Fields(lngColumn).Value = xlc.Offset(0, lngColumn).Value
Next lngColumn
rst.Update
Set xlc = xlc.Offset(1, 0)
x = x +1
Loop
SysCmd acSysCmdRemoveMeter
Unfortunately
Code:
xlEndRow = xls.Range("A65555").End(xlUp).Row
Is it possible to do what I "want" or is there an alternative simple way to create such a Progress Bar?
Many thanks,
Des.