Is there a more elegant way of deleting records from VB than this? >>> (1 Viewer)

daninthemix

Registered User.
Local time
Today, 17:39
Joined
Nov 25, 2005
Messages
41
Code:
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
 

Bat17

Registered User.
Local time
Today, 17:39
Joined
Sep 24, 2004
Messages
1,687
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord

Peter
 

daninthemix

Registered User.
Local time
Today, 17:39
Joined
Nov 25, 2005
Messages
41
Any way of physically removing the data from the table by code wihtout referring to menu commands?
 

Bat17

Registered User.
Local time
Today, 17:39
Joined
Sep 24, 2004
Messages
1,687
create a delete query using the form as criteria, then requery the form?

Peter
 

steevie_t

Registered User.
Local time
Today, 17:39
Joined
Feb 9, 2006
Messages
21
Or just execute a little bit of SQL.


CurrentProject.Connection.Execute "DELETE * FROM tblMyTable WHERE lngMyTableID = " & lngRecIDToDelete & ";"

Me.Requery
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:39
Joined
Feb 19, 2002
Messages
43,484
You can also set a reference to the form's RecordSetClone and use DAO to delete the record.
 

Users who are viewing this thread

Top Bottom