Hi all, i am using ms access 2003,
i have a form,
i connect to the mysql database using adodb connection.
this works fine.
but when i delete a record, it is deleted but still the record set shows that record.
when i close the application and again run it, then the record set dosnt show the delted record.
what could be the problem
my code goes like this
rsInfotable is a adodb record set
i opened the record set with the code -
str = "select * from infotable;"
-
rsInfotable.Open str, objConn, adOpenKeyset, adLockOptimistic
-
-
-
If txtAutonumber.Visible Then
-
-
-
-
rsInfotable.Delete
-
-
-
MsgBox ("Record has been successfully Deleted")
-
rsInfotable.MoveNext
-
-
-
If rsInfotable.EOF And rsInfotable.BOF Then
-
MsgBox ("No more records")
-
Call DiableButtons
-
Exit Sub
-
-
ElseIf rsInfotable.EOF Then
-
rsInfotable.MoveLast
-
Call DisplayData
-
-
-
End If
-
End If
-
though i do it with rsInfotable.delete it still shows the record in the record set
7 5737
Hi
I am not sure how this deleted record shows its self in the procedure (ie. what is the problem?), but just perhaps you could change this
If rsInfotable.EOF And rsInfotable.BOF Then
to this
If rsInfotable.RecordCount = 0 Then
????
MTB
my application target is very simple that
1. connect to the database
2. add records,
3. edit records,
4. navigate through records
5. and delete records.
i am doing all these fine except that deleting record.
when i delete with my code, the records are deleted in the database, but the record set still contains that record.
suppose say, i have 20 records, and now i am at say 8th record, now i pressed delete button and i perform a movenext action. The record is deleted in database, but when i press previous button or like that, i am still able to see that record in my recordset. I.e i am able to navigate through the deleted record which is wrong.
do i need to requery the record set?
if i requery the recordset, then the current position will be lost which is not a correct approach.
what is happening with my code?
thank you
Hi again
Well, I cannot fine any think wrong with your code (except for to suggestion in my last post as an error occures when there are not records left!). Other than that I cannot see where this is a problem for you (ie where does this error/probelm occure?). Perhaps I am missing something simple.
Just one thought, deleted records do remain in a FORM until it is Requeried?
MTB
Hi, i attached my application.
indeed there is no error coming.But functionality is wrong in my code.
have a look at the attachment.
Open the database,
1.Run the form
2. Click open connection button
3. navigate to some record, or go to final record
4. Now press delete. there comes confirmation message that record has been deleted.
5. now click previous button, or some how navigate through the records.
the deleted record still appears.
what should i do to delete from the record set
if you want to add records, click create record, enter the fields and click save button
Note:Please do not enter last field(long) while creating record. it wil not be saved, and gives error. there is some problem.
thank you
Hi
Unfortunately IT policy does not permit me to down load files, so I cannot look at this, but hopefully someone else will. Paticularly as I cannot simulate your problem, the deleted record just disapear when the recordset is moved.
Sorry cannot be of more help.
MTB
Hi ravindarjobs. The form's code module in the example database does not compile - there is a type mismatch in the line RecordNavigationControl6.ControlSource = rsInfotable
of your OpenConnection_Click sub. The controlsource cannot be a recordset type - it should be a tablename, query name or SQL statement of some kind. Anyway, it has nothing to do with the error being investigated.
Commenting that line out leads to another error - as we have no access to the data source that is still specified for your connection object. For test purposes you need some local data source that we can access too - such as a table within the current database.
You should make sure that any database you attach is free from errors before you attach it - encountering avoidable mistakes like this is not helpful to anyone who is spending time looking at your application...
Like MTB, I can see no obvious error in your delete routine. I wonder if you have the relevant permissions on the underlying table, however. Don't be fooled by the message saying the record is deleted - at least if what you are referring to is your own messagebox call saying the record is deleted - does not mean the system did delete the record.
I would suggest that you set up a test table within your application itself, open that table in the ADO recordset instead of the remote target, and verify as MTB has done that the code deletes a target record. If so, it is clearly a permissions issue that is preventing you from deleting the record in the remotely-connected data source.
-Stewart
NeoPa 32,556
Recognized Expert Moderator MVP
I know MTB mentioned it earlier, but I'm wondering if you caught it, as I've seen no further mention of it. After deleting a record, the recordset keeps the record holder until it is requeried.
Either requery the recordset when necessary, or recode to handle this and skip past such records where found.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: karenmiddleol |
last post by:
The following code works fine I can connect to a SQL database and list
all the records in the Orders table onto a web page.
Now our users want me to modify it so that each row displayed as a...
|
by: Robert Schneider |
last post by:
Hi to all,
I don't understand that: I try to delete a record via JDBC. But I always
get the error SQL7008 with the error code 3. It seems that this has
something to do with journaling, since the...
|
by: Jan |
last post by:
Hi
I have a database that I use to keep track of the sales promotions that we
send to companies.
I normally send a mailing based on a subset of the companies in the database
(found using the...
|
by: Rich |
last post by:
I have a page that list all records in an access table. I would like to add
a delete record function to the list to delete selected records. Here is my
current code:
...
|
by: 60325 |
last post by:
This is the page where I collect the data in drop-down boxes with
values of 1-10 and send it to a submitted page to do calculations.
Example:
Employee1 TeamScore(1-10)
Employee2 ...
| |
by: John Fairhurst |
last post by:
Hi,
The following code should select the specified number of records randomly
from the database
<%
....
query = "SELECT FROM "
Set RS = Server.CreateObject("ADODB.Recordset")
|
by: igendreau |
last post by:
I'm trying to clean up a database of mine, and I need to convert some
old DAO code over to ADO. When I was using DAO, I had no problem
running this script and deleting the record using rs.Delete. ...
|
by: beebelbrox |
last post by:
Hi, I am new VB programming in Access and I am requesting help with the following code.
WIndows OS MSaccess 2003
This code is attached to an unbound form that will display a specific recordset...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
| |
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
|
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...
|
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 ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |