Solved

"No current record" error merssage

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…

920 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

12 Experts available now in Live!

Get 1:1 Help Now