Solved

"No current record" error merssage

Posted on 1998-10-16
3
222 Views
Last Modified: 2011-09-20
After deleting all records in a .mdb database, I get a no current record error message when I try to add a new record.
0
Comment
Question by:edmac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 5

Expert Comment

by:chewhoung
ID: 1440299
Try Refresh the data control after delete.
eg:
Data1.refresh

0
 
LVL 5

Accepted Solution

by:
AnswerTheMan earned 100 total points
ID: 1440300
something id wrong with your CODE. try :


Private Sub Command1_Click()
       Dim MyData As Database
       Set MyData = OpenDatabase("FilePath",False,False)        
       Dim MyRec As Recordset
       Set MyRec =MyData.OpenRecordset("tblExample",dbOpenTable)
       With MyRec
             Do While .EOF = False
                     .Delete
                     .MoveNext
             Loop
             .AddNew
             .Fields("fldExample1") = "MyValue"
             .Fields("fldExample2") = "YourValue"
             .Update
             .Close
        End With
        MyData.Close
End Sub


0
 
LVL 4

Expert Comment

by:CraigLazar
ID: 1440301
trap the error vb returns and assign your field names null values until there is a new record in the datagbase , then go data1.refresh
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question