DFS wrote:
g_**********@yahoo.com wrote:
>>Hi. I have a button - Command9 with the Click event to run this code
on a form called frmSelforDel.
Dim SQL1 As String
DoCmd.SetWarnings False
SQL1 = "DELETE FROM 260Land WHERE 260ID = txtDel.Value"
On that same form is a text box named txtDel with a set value. 260Land
is a table with 260ID as a column.
I'm not knowledgeable enough to get the syntax correct on this
statement. Please help. Thank you!
Greg.
Dim db as DAO.Database, strSQL as String
Set db = currentDb()
db.Execute("DELETE FROM 260Land WHERE [260ID] = '" & Me.txtDel.Value & "';")
Without bracketing the column name, the '260' prefixes may give you
problems.
No offense, but 260Land is a strange name for a table. What's in it?
To the original poster, you need to remember dates are surrounded by #,
strings by quotes, and numbers by themselves
txtDel = "YourName"
? "WHERE [260ID] = '" & txtDel & "';"
WHERE [260ID] = 'YourName';
? "WHERE [260ID] = """ & txtDel & """;"
WHERE [260ID] = "YourName";
txtDel = Date()
? "WHERE [260ID] = #" & txtDel & "#;"
WHERE [260ID] = #4/5/2008#;
txtDel = 123
? "WHERE [260ID] = " & txtDel & ";"
WHERE [260ID] = 123;
IceCube
http://www.youtube.com/watch?v=HzeZhCt5PVA