Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

"No current record" error merssage

Posted on 1998-10-16
3
Medium Priority
?
226 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 300 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

618 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