473,657 Members | 2,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error 'No Current Record' when trying to delete

52 New Member
i'm trying to create a reminder form, when i add a new reminder its ok but when i try to delete a reminder then i get No Current Record problem.

Form Load
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.     Dim s() As String
  3.     Dim ListTime As String
  4.     Dim ListDate As String
  5.     Dim i As Integer
  6.     Set dbReminder = OpenDatabase(App.Path & "\Password.mdb")
  7.     Set rsReminder = dbReminder.OpenRecordset("Reminder", dbOpenDynaset)
  8.  
  9.     If Not rsReminder.EOF Then rsReminder.MoveFirst
  10.  
  11.     Do While Not rsReminder.EOF
  12.         lstReminder.AddItem rsReminder!Rno & "." & " " & rsReminder!Name & vbTab & vbTab & rsReminder!Date & vbTab & rsReminder!Time
  13.         lstReminder.ItemData(lstReminder.NewIndex) = rsReminder!Rno
  14.         rsReminder.MoveNext
  15.     Loop
  16.     For i = 0 To lstReminder.ListCount - 1
  17.         s = Split(lstReminder.List(i), vbTab)
  18.         ListTime = Mid(s(UBound(s)), 1, Len(s(UBound(s))) - 3)
  19.         ListDate = s(UBound(s) - 1)
  20.         If ListTime = Mid(Time, 1, Len(Time) - 3) And ListDate = Date Then
  21.             MsgBox rsReminder!Name & "ghghgh"
  22.         End If
  23.     Next
  24. End Sub
  25.  
My List Box
Expand|Select|Wrap|Line Numbers
  1. Private Sub List1_Click()
  2.     rsReminder.FindFirst "Rno=" & (lstReminder.ItemData(lstReminder.ListIndex))
  3.     rsReminder!Rno = frmReminder.txtno.Text
  4.     rsReminder!Name = frmReminder.txtName.Text
  5.     rsReminder!Date = frmReminder.txtDate.Text
  6.     rsReminder!Time = frmReminder.txtTime.Text
  7.     rsReminder!Comments = frmReminder.txtComment.Text
  8. End Sub
  9.  
My Delete Button
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdDelete_Click()
  2.     Const strDelete As String = "Are you sure you want to delete this record?"
  3.     Dim response As Integer
  4.  
  5.     response = MsgBox(strDelete, vbYesNo + vbQuestion + vbDefaultButton2, "Delete record")
  6.     If response = vbYes Then
  7.       rsReminder.Delete
  8.       lstReminder.RemoveItem lstReminder.ListIndex
  9.      ' MsgBox txtFname & " " & txtSname & " has been deleted from the record", vbInformation + vbOKOnly, "Record Deleted"
  10.      ' Call cmdClear_Click
  11.     End If
  12. End Sub
  13.  
I get the error on this line " rsReminder.Dele te" on the delete button. Does anyone know what is the poblem.
I THANK U ANY ANSWERS
Mar 13 '08 #1
1 1883
Killer42
8,435 Recognized Expert Expert
I think the problem is in your listbox click routine. You're not selecting a record, but simply stuffing values into the recordset as though you were about to store a new record.

I'd say that routine probably should be doing a FindFirst or similar, to position the recordset to the selected record.
Mar 14 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
4051
by: Steve | last post by:
I have several pairs of synchronized subforms in an application. I have a Delete button for each pair that uses the following code or similar to delete a record in the second subform: DoCmd.SetWarnings False DoCmd.RunCommand acCmdDeleteRecord DoCmd.SetWarnings True End If ExitHere: Me!SubName.SetFocus
4
9404
by: Stephen | last post by:
Hello People, Using MS Access 2003 VBA I get the error 3020 Update or CancelUpdate without AddNew or Edit when I run through the following code. Can anyone help suggest anything to try? Thanks. On Error GoTo delete_failed Dim RS_DEL As DAO.Recordset
0
5063
by: Jamey | last post by:
I perused old posts for an answer to this for at least an hour, and I've found a work-around, but no definitive answer. Synopsis of the problem: On NotInList or ctl.Requery commands where a record has been deleted (or appended via SQL), Access returns Runtime error 2118 when you get to the Requery command which reads: 'You must save the current field before you run the Requery action.'
3
26265
by: hebandgene | last post by:
When I delete a record in a subform I get the warning that I'm about to delete a record, followed by an error "No current record." When I click OK obviously the record is deleted and it goes to the first record (as I've coded it to do) or it shows me a blank record if the deleted record was the only one. So, what I'd like to do is bypass that 'No current record' altogether to avoid user confusion. Is there any way to code it out...
3
6883
by: Nathan Bloomfield | last post by:
Hi there, I am having difficulty with a piece of code which would work wonders for my application if only the error trapping worked properly. Basically, it works as follows: - adds records from rsSource into rsDest - if it finds a key violation then it deletes the current record from rsDest and adds the new record from rsSource. This works perfectly - but only for the first found duplicate record, it brings up the error
0
2125
by: Roman | last post by:
I'm trying to create the form which would allow data entry to the Client table, as well as modification and deletion of existing data rows. For some reason the DataGrid part of functionality stops working when I include data entry fields to the form: I click on Delete or Edit inside of DataGrid and get this error: "Error: Object doesn't support this property or method" If I remove data entry fields from the form - DataGrid allows to...
8
9449
by: Razak | last post by:
Hi, I have a class which basically do Impersonation in my web application. From MS KB sample:- ++++++++++++++++++++code starts Dim impersonationContext As System.Security.Principal.WindowsImpersonationContext Dim currentWindowsIdentity As System.Security.Principal.WindowsIdentity
1
6074
by: Akinyemi | last post by:
I created a Database which I named "Address". I went through the Control Panel and created a DSN to enable me connect to the Database through ODBC. I then created a Form with the same fields as that of the Database. I wrote the necessary codes and ran the Program. Below are my codes and the runtime error I received: Run-Time Error -2147217904(80040e10): Too few parameters. Expected 1
5
3175
by: prakashwadhwani | last post by:
The Delete Event/Proc & "Save_Fields_In_Form_Header" Event/Proc in my form were working perfectly. However, after I added a call to the "Save_Fields_In_Form_Header" Event/Proc in the "Current" Event of my form, and I now try to Delete a record, I get ... Run-Time Error 3218 - Could not Update; Currently Locked. My Access application then effectively freezes forcing me to shut Access down & re-start. The record DOES get deleted...
0
8402
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8829
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8734
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8508
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7341
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6172
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4323
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2733
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1627
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.