473,432 Members | 1,767 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,432 software developers and data experts.

Access 2000 Delete ADDs a New record? Help

Access 2000 Windows XP

Hi Everybody

I have got a weird one here.

I have a large form frmTransactions based on a single table
tblTransactions.

There are a lot of fields on the form but everything works OK. That is
until you want to delete a record on the EOF that not much data has
been entered. Where the user has started a new record without
completing it and just got the TransactionID entered.

So now I want them to be able to delete this record:
I have tried
DoCmd.RunCommand acCmdDeleteRecord
and I've tried
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord

But no joy.

Now here is the strange bit. As I delete this record it ADDs another
one with the autonumber, and I actually see one TransactionID disappear
and a higher one appear. Twighlight Zone stuff I think.

THis not happening with another form that I experimented with, or on
the table itself.

Any help would be most appreciated.

Bob

Dec 4 '05 #1
6 2084
bobdydd wrote:
Access 2000 Windows XP

Hi Everybody

I have got a weird one here.

I have a large form frmTransactions based on a single table
tblTransactions.

There are a lot of fields on the form but everything works OK. That is
until you want to delete a record on the EOF that not much data has
been entered. Where the user has started a new record without
completing it and just got the TransactionID entered.


If a new record has not yet been saved, then it cannot be deleted. You just
need to cancel the insertion.

If Me.NewRecord Then
'record never saved. just cancel it
Me.Undo
Else
'cancel any current changes
Me.Undo
DoCmd.RunCommand acCmdDeleteRecord
End If

I structured the above for clarity. Obviously you could just have a single Undo
before the If-Then block.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Dec 4 '05 #2
Hi Rick

I altered it slighltly and it worked

DoCmd.RunCommand acCmdDeleteRecord
If Me.NewRecord Then
'record never saved. just cancel it
Me.Undo
Else
'cancel any current changes
Me.Undo
DoCmd.RunCommand acCmdDeleteRecord
End If

Thanks a lot

Dec 4 '05 #3
"bobdydd" <re**************@yahoo.co.uk> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com
Hi Rick

I altered it slighltly and it worked

DoCmd.RunCommand acCmdDeleteRecord
If Me.NewRecord Then
'record never saved. just cancel it
Me.Undo
Else
'cancel any current changes
Me.Undo
DoCmd.RunCommand acCmdDeleteRecord
End If

Thanks a lot


It looks to me like that's going to delete two records, most of the
time -- the current one, and the one after it. Are you sure it's doing
what you want?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
Dec 5 '05 #4
Hi Dirk
Thanks for pointing that out. I have changed it to:

DoCmd.RunCommand acCmdDeleteRecord
If Me.NewRecord Then
'record never saved. just cancel it
Me.Undo
End If

Which ssems to do the trick

Dec 5 '05 #5
"bobdydd" <re**************@yahoo.co.uk> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com
Hi Dirk
Thanks for pointing that out. I have changed it to:

DoCmd.RunCommand acCmdDeleteRecord
If Me.NewRecord Then
'record never saved. just cancel it
Me.Undo
End If

Which ssems to do the trick


I still think you've got a problem there, and maybe you have error
messages turned off and aren't seeing it. What was wrong with the code
Rick Brandt originally posted? That code looks right to me.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
Dec 5 '05 #6

"Dirk Goldgar" <dg@NOdataSPAMgnostics.com> wrote in message
news:eJ**************@tk2msftngp13.phx.gbl...
"bobdydd" <re**************@yahoo.co.uk> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com
Hi Rick

I altered it slighltly and it worked

DoCmd.RunCommand acCmdDeleteRecord
If Me.NewRecord Then
'record never saved. just cancel it
Me.Undo
Else
'cancel any current changes
Me.Undo
DoCmd.RunCommand acCmdDeleteRecord
End If

Thanks a lot


It looks to me like that's going to delete two records, most of the
time -- the current one, and the one after it. Are you sure it's doing
what you want?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Dec 6 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: John Phelan | last post by:
I read an article by, by Mike Groh, in Access-VB-SQL Advisor Magazine, Week 37 that concerns me quite a bit on distributing Access Applications commercially. First I need to describe a "commercial...
1
by: Steve Claflin | last post by:
I have a database with a moderate number of records in several tables (the biggest table at the moment is about 800 records). In development it got moved between 2K and XP repeatedly. Several...
3
by: John | last post by:
Hi I have an access app that runs fine on access 2000 on a windows 2000 pc. I installed access 2000 on a second win xp pro pc with ms office xp small business already installed. When I run the...
3
by: Sebastian C. | last post by:
Hello everybody Since I upgraded my Office XP Professional to SP3 I got strange behaviour. Pieces of code which works for 3 years now are suddenly stop to work properly. I have Office XP...
49
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The...
2
by: bobdydd | last post by:
Hi Everybody I have got a weird one here. I have a large form frmTransactions based on a single table tblTransactions. There are a lot of fields on the form but everything works OK. That is...
0
by: laurent | last post by:
Environment: VS NET 2003 Fr Framework: 1.1 OS: WinXP SP2 Fr Hello I have a problem to add with pop-up and to delete in a datagrid(ButtonColumn delete) on WebForms. code button HTML which...
3
by: Jiwei06xie | last post by:
Dear Experts, As I am a beginner of Access 2000, could I ask for some help regarding the following situation? I have two tables called tblDelivery and tblStock, both having a text field...
1
by: Bobby | last post by:
Hi I am using Access 2003 mdb as a front end to an application which uses SQL Server 2000 as the backend. The two are connected using ODBC. On one particular table (the Stock table), I have a...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
1
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...
0
tracyyun
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...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.