Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No Current Record Problem

Status
Not open for further replies.

joeythelips

IS-IT--Management
Aug 1, 2001
305
IE
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#] <> &quot;&quot; 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
 
just insert this code where you are having the problem

Set rstable = dbtable.OpenRecordset(&quot;select * from startupbills&quot;)

if rstable.EOF()then
exit sub
endif
rstable.MoveFirst




Nkabirwa Sowed Magezi
nkabirwa@yahoo.com

A Ugandan Developer for

(1) School Management Information System(SMIS) - Foxpro 2.6 ; Ms-Acess 97

(2)Debt onitoring System(DMS) - Ms-Acess 97

(3) The Loans Recovery System(LS) - Ms- Access 97

(4) The Dry Cleaners System(DS) - Ms- Access 97
 
hi,
i've tried that and it gets rid of the 'no current recod problem'
However, i am still left with the problem that the function 'fillinblanks' is not being processed as the code thinks there is no records in the temp table (when there actually is!!)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top