joeythelips
IS-IT--Management
Hi
I have an access 2000 database application.
The application imports excel files to a temporary table (startupbills), fills in any blanks in the excel file by calling a function called fillinblanks, and then appends the data to another table.
This application was developed almost 2 years ago, and the import always worked perfectly along with the function to fill in the blanks.
However, over the past few weeks, the main user of the system has repeatedly reported the same bug to me:
When she imports the file, she gets a message saying:
'Run time error 3021
No current record'
But all the data appends to the main table in the db?
When i click on the debug option, the problem points to the fillinblanks function.
Dunno if anyone can help me with this, but if they could i would really be grateful.
Here's the code:
Private Sub fillinblanks()
Dim wstable As Workspace
Dim dbtable As Database
Dim rstable As Recordset
Dim firstfield As String
Dim secondfield As String
Dim thirdfield As String
Dim fourthfield As String
Dim fifthfield As Date
Dim sixthfield As String
Set wstable = DBEngine.Workspaces(0)
Set dbtable = wstable.OpenDatabase("O:\datahub\WIP_INFO.mdb"
Set rstable = dbtable.OpenRecordset("select * from startupbills"
rstable.MoveFirst 'THIS IS THE EXACT POINT OF FAILURE
Do Until rstable.EOF = True
If rstable![Meter Ref#] <> "" Then
firstfield = rstable![Meter Ref#]
secondfield = rstable![Customer Name]
thirdfield = rstable![Site Address]
fourthfield = rstable!Profile
fifthfield = rstable![Contract Date]
sixthfield = rstable![Reading Type]
Else
rstable.Edit
rstable![Meter Ref#] = firstfield
rstable![Customer Name] = secondfield
rstable![Site Address] = thirdfield
rstable!Profile = fourthfield
rstable![Contract Date] = fifthfield
rstable![Reading Type] = sixthfield
rstable.Update
End If
rstable.MoveNext
Loop
rstable.Close
dbtable.Close
wstable.Close
End Sub
I have an access 2000 database application.
The application imports excel files to a temporary table (startupbills), fills in any blanks in the excel file by calling a function called fillinblanks, and then appends the data to another table.
This application was developed almost 2 years ago, and the import always worked perfectly along with the function to fill in the blanks.
However, over the past few weeks, the main user of the system has repeatedly reported the same bug to me:
When she imports the file, she gets a message saying:
'Run time error 3021
No current record'
But all the data appends to the main table in the db?
When i click on the debug option, the problem points to the fillinblanks function.
Dunno if anyone can help me with this, but if they could i would really be grateful.
Here's the code:
Private Sub fillinblanks()
Dim wstable As Workspace
Dim dbtable As Database
Dim rstable As Recordset
Dim firstfield As String
Dim secondfield As String
Dim thirdfield As String
Dim fourthfield As String
Dim fifthfield As Date
Dim sixthfield As String
Set wstable = DBEngine.Workspaces(0)
Set dbtable = wstable.OpenDatabase("O:\datahub\WIP_INFO.mdb"
Set rstable = dbtable.OpenRecordset("select * from startupbills"
rstable.MoveFirst 'THIS IS THE EXACT POINT OF FAILURE
Do Until rstable.EOF = True
If rstable![Meter Ref#] <> "" Then
firstfield = rstable![Meter Ref#]
secondfield = rstable![Customer Name]
thirdfield = rstable![Site Address]
fourthfield = rstable!Profile
fifthfield = rstable![Contract Date]
sixthfield = rstable![Reading Type]
Else
rstable.Edit
rstable![Meter Ref#] = firstfield
rstable![Customer Name] = secondfield
rstable![Site Address] = thirdfield
rstable!Profile = fourthfield
rstable![Contract Date] = fifthfield
rstable![Reading Type] = sixthfield
rstable.Update
End If
rstable.MoveNext
Loop
rstable.Close
dbtable.Close
wstable.Close
End Sub