Solved

"No current record" error merssage

Posted on 1998-10-16
3
218 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
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now