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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

failing to delete record

Status
Not open for further replies.

ugly

Programmer
Jul 5, 2002
70
GB
This piece of code picks up a value from a list box and writes it to myString (that works ok). I then want to use this value
to delete a corresponding value from my table called drawings. The last line in this code is failing? Thanks for any pointers.

Dim myString As String
Dim strSQL As String
myString = List8.Column(0)
MsgBox (myString)
DoCmd.RunSQL ("DELETE FROM drawings WHERE (((Autokey)='" & myString & "'));")
 
Are you sure that Autokey is a text field?
 
perhaps the issue is that an autokey is an integer, not a string. And all the parentheses are confusing to me - I don't think they are all necessary.

You might try this:

Dim myString As Long
Dim strSQL As String

myString = List8.Column(0)
MsgBox (myString)
DoCmd.RunSQL ("DELETE FROM drawings WHERE Autokey =" & myString & ";")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top