Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete from access table

Status
Not open for further replies.

JRudisill

Programmer
Aug 4, 2003
54
US
Trying to delete record from access table. I can connect to the database but when I delete I get -1 returned.

STORE SQLSTRINGCONNECT("Driver={Microsoft Access Driver (*.mdb)};Dbq=" + DataDrive() + DataPath() + "VfFeatures.mdb;Uid=Admin;Pwd=;") TO Connected

If Connected < 0
MsgBox("Record could not be deleted")
Else
t = SQLEXEC(Connected, 'Delete FROM Features Where Features.ClubId = ' + AllTrim(.txtMemberId.value))
EndIF
 
You can use AERROR to check what error is returned:
Code:
STORE SQLSTRINGCONNECT("Driver={Microsoft Access Driver (*.mdb)};Dbq=" + DataDrive() + DataPath() + "VfFeatures.mdb;Uid=Admin;Pwd=;") TO Connected
            
If Connected < 0
    MsgBox("Record could not be deleted")
Else
      t = SQLEXEC(Connected, 'Delete FROM Features Where Features.ClubId = ' +  AllTrim(.txtMemberId.value))
      IF m.t < 0
         AERROR(errArr)
         MessageBox(errArr[1,2])
EndIF

Borislav Borissov
 
JRudisill,

What is the data type of .txtMemberID.Value? If it's a string, you will need to pass it in single quotes:

t = SQLEXEC(Connected, "Delete FROM Features Where Features.ClubId = ' " + AllTrim(.txtMemberId.value) + " ' ")

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top