473,505 Members | 16,800 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Button adds instead of deletes a record!

When I add a button and choose in the wizzard for Delete Record
operation, it does not work, instead it ADD's a record? How come?

This is the VB contents of the button:

Private Sub CmdDelete_Click()
On Error GoTo Err_CmdDelete_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Exit_CmdDelete_Click:
Exit Sub

Err_CmdDelete_Click:
MsgBox Err.Description
Resume Exit_CmdDelete_Click

End Sub
Bart
Acc 2003

Oct 25 '06 #1
2 1371

AA Arens wrote:
When I add a button and choose in the wizzard for Delete Record
operation, it does not work, instead it ADD's a record? How come?

This is the VB contents of the button:

Private Sub CmdDelete_Click()
On Error GoTo Err_CmdDelete_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Exit_CmdDelete_Click:
Exit Sub

Err_CmdDelete_Click:
MsgBox Err.Description
Resume Exit_CmdDelete_Click

End Sub
Bart
Acc 2003
Very strange! I have just copied and pasted the code into a newly
created button and Hey Presto it deletes. Can only suggest you try the
same thing, i.e. create a new button and copy and paste the code into
it.

Oct 25 '06 #2
Still no result. I even tried to copy grom another databse, but the VB
text is the same. I also tried to open the databse from another PC,
same problem.
I also have choosen Menu Tools Compact and Repair Database.

Is there another way to delete a record from a form, so I can check
whether the delete record is blocked at all or not.

There are no problems in other (sub-)forms of the same database.

Bart
Tanis wrote:
AA Arens wrote:
When I add a button and choose in the wizzard for Delete Record
operation, it does not work, instead it ADD's a record? How come?

This is the VB contents of the button:

Private Sub CmdDelete_Click()
On Error GoTo Err_CmdDelete_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Exit_CmdDelete_Click:
Exit Sub

Err_CmdDelete_Click:
MsgBox Err.Description
Resume Exit_CmdDelete_Click

End Sub
Bart
Acc 2003

Very strange! I have just copied and pasted the code into a newly
created button and Hey Presto it deletes. Can only suggest you try the
same thing, i.e. create a new button and copy and paste the code into
it.
Oct 26 '06 #3

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

Similar topics

3
3144
by: cfxchange | last post by:
I am looking into work-arounds for what seems to be a flaw, or "undocumented feature" of SQL Server replication and Instead of Delete triggers not playing together. It seems that if you want to...
9
3412
by: (Pete Cresswell) | last post by:
Seems like when there's a 1:1 relationship, the order of referential integrity enforcement depends on which way you drag the mouse pointer when drawing the relationship line. If you drag from...
1
2392
by: Norman Fritag | last post by:
Hi there, I have one subform in a Master form, which is set to add mode only. I allow only for data entry. Sofar all words fine. All information on the main form is set for display only and have...
9
5711
by: Melissa | last post by:
What is the code to delete a command button from a form? Can the code be run from the click event of the button to be deleted? Thanks! Melissa
1
7187
by: John Michael | last post by:
Is it possible to detect when someone has pushed their Esc button on a form. When a form is open and someone is adding a record, if they push the esc button, the whole form gets reset to an empty...
2
9936
by: Jacko | last post by:
I have a jazz records archive database which is supposed to be updatable via an input form. Despite setting the form's properties so that it will accept edits, deletes etc the new record button...
2
1202
by: Mike N. | last post by:
If a user fills in some fields on a form, then decides not to enter the record, what method is used to cancel the record? Everything I try, still adds the record to the table. I'd just like to...
14
4945
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons...
4
7806
by: martin | last post by:
Hello, Is there a way to make a kind of "cancel" button on a form? Suppose you accidently changed or overwrote some data in a form, then I'd like to leave this form at once and cancel any...
0
7218
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,...
0
7103
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
7370
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
7021
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
7478
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
5614
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,...
1
5035
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
3188
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...
1
755
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.