Delete record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi! Anybody knows why the action button "Delete record" in a form (access xp) does
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer7
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer7
the first one is for action "delete" .. but the second one goes for "copy" .. I do not understand why it uses the second one.

The reason I am trying to understand this is because I want to delete a record from a form with the design "table" ... so I need to know how to tell which is the record I want to delete. (the action button "delete record" only works with a form with only one record in it

THANK
 
If you look at the argument acMenuVer70 which specifies using the Menu
set-up of Access 95 (which is Access version 7.0), the code is the old style
as DoMenuItem is only available for backward compatibility only. IIRC,
item 8 of the Edit Menu in Access95 was to select the whole Record and item
6 is to delete the current Record.

If you want to delete the current Record, change the 2 statements to:

DoCmd.RunCommand acCmdDeleteRecord

Check Access VB Help on the RunCommand Method.

--
HTH
Van T. Dinh
MVP (Access)



B said:
Hi! Anybody knows why the action button "Delete record" in a form (access xp) does :
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
the first one is for action "delete" .. but the second one goes for "copy"
... I do not understand why it uses the second one.
The reason I am trying to understand this is because I want to delete a
record from a form with the design "table" ... so I need to know how to tell
which is the record I want to delete. (the action button "delete record"
only works with a form with only one record in it)
 
Back
Top