Deleting Records

  • Thread starter Thread starter James
  • Start date Start date
J

James

Is there anyway I can have a command button that deletes
the selected record?

Many Thanks

James
 
James

For simplicity, create a command button using the wizard. It will step you
through a series of wizard pages, one of which is Record Operations. In
this, you can select the "Delete Record" and see the code that is generated.

This is at least one step to learn what goes on behind the scenes.

HTH

--
Rob

FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
I have done this and it gioves me teh follwoing code which
seems to do nothing...

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, ,
acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, ,
acMenuVer70

Is there any code which I could put in that would just
delete the record?
 
Hello,

For some reason its not deleting as it should come up and
ask me if I wish to delete the record and its not doing
that plus I have done as you asked and I still have the
record in my table.

Is there any other way I can do this as the previous way
stated does not seem to work...

Although if I use the delete record button on the toolbar
that seems to do the trick...

Many Thanks

James
 
One simplified approach would be to use the DoCmd.RunSQL <sql>

You write out the sql string you wish to execute.

Something like:

Delete From tblCustomers Where ID=3

or

Delete From tblCustomers Where State='DC'

HTH

--
Rob

FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
I need it to delete the selected record...

IE..

In a subform I have a set of records and I wish to delete
one of them so I select it and click on teh button to
delete it but I dont yet have the button as I cant figure
out how to do it plus the fact everything I have tried has
failed...

Its not good....

Any more suggestions?

Many Thanks for all this

James
 
Back
Top