473,325 Members | 2,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Missing Operator syntax error is SQL VB code

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.
Apr 5 '08 #1
3 2002
DFS
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?
Apr 5 '08 #2
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
Apr 5 '08 #3
On Apr 4, 11:05*pm, "DFS" <nospam@dfs_.comwrote:
g_k_harri...@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?
Thanks very much! Yes, the number preceding ID was definitely a
problem. 260Land is a section of a form that's the basis for this
database and covers land cost, surveying insurance, etc... I
appreciate your help greatly!
Apr 7 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
4
by: dcarson | last post by:
I've read about this error in several other discussions, but still can't seem to pinpoint the problem with my code. Everything seemed to be working fine for some time, but it now tends to bomb out...
1
by: Alan Murrell | last post by:
Hello, One of our web hosting clients is getting the following error when someone tried to log in form their login page: --- ODBC ERROR --- Microsoft OLE DB Provider for ODBC Drivers error...
1
by: JMCN | last post by:
I have an ftp program that i inherited and i tried to modify it to ftp over my file however, i receive an error message : run-time error '3075 syntax error (missing operator) in query expression...
4
Tog
by: Tog | last post by:
Hello, I have read several posts with this heading but none of them have helped. I have the following error message: Syntax error (missing operator) in query expression 'left(Your Product...
10
by: kabradley | last post by:
Hey guys, I'm using an embedded sql statement tied to a command button to append records in a certain table. The code for the sql statement is as follows. 'Define sql string strSQL = "INSERT INTO...
5
by: UAlbanyMBA | last post by:
I am getting a syntax error missing operator when I try to created a record set by selecting a record from a list box. I do not know where the error is though. Everything looks good, as a matter of...
4
by: thebarefootnation | last post by:
Hi I have the following error message "Syntax Error (missing operator) in query expression" occurring when I am trying to update combo box within a form. My code is: Dim strSQL As String
4
by: nerd4access | last post by:
Hello all! I am not new to access, but new to coding (and posting). I have a database that I have created and need some help with a login form. When a user opens the database, a form pops up...
2
by: aaron6098 | last post by:
I am trying to finish my final project for my programing class. i keep on getting Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80040E14) Syntax error (missing operator) in query...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.