error 3075 syntax missing comma

santaaimonce

I've looked in many places on the internet trying to solve this problem but I can't seem to figure it out. Could someone just provide a second set of eyes and just check where I may have gone wrong with the syntax?

The error says RunTime error 3075, "Syntax error (comma) in query expression '('test',12/15/2014','Primary')'.

Originally it worked when I had this split into four different INSERT statements, but when I combined it, it stopped working

    SQL = "INSERT INTO WeeksonCall([Employee], [Week], [Prim/Backup]) VALUES (('" & _ cboName.Column(1) & "','" & cboWeek.Column(1) & "','" & cboPrimBack.Value & _
"'),('" & cboName2.Column(1) & "','" & cboWeek.Column(1) & "','" & cboPrimBack2.Value & _
"'),('" & cboName.Column(1) & "','" & cboWeek2.Column(1) & "','" & cboPrimBack2.Value & _
"'),('" & cboName2.Column(1) & "','" & cboWeek2.Column(1) & "','" & cboPrimBack.Value & "'))"
Linger

That is not proper syntax in MS Access. You will have to insert the records individually like:

DoCmd.SetWarnings False

SQL = "INSERT INTO WeeksonCall(Employee, Week, [Prim/Backup]) " & _
"VALUES ('" & _ cboName.Column(1) & "','" & cboWeek.Column(1) & "','" & cboPrimBack.Value & "')"

SQL = "INSERT INTO WeeksonCall(Employee, Week, [Prim/Backup]) " & _
"VALUES ('" & cboName2.Column(1) & "','" & cboWeek.Column(1) & "','" & cboPrimBack2.Value & "')"

SQL = "INSERT INTO WeeksonCall(Employee, Week, [Prim/Backup]) " & _
"VALUES ('" & cboName.Column(1) & "','" & cboWeek2.Column(1) & "','" & cboPrimBack2.Value & "')"

SQL = "INSERT INTO WeeksonCall(Employee, Week, [Prim/Backup]) " & _
"VALUES ('" & cboName2.Column(1) & "','" & cboWeek2.Column(1) & "','" & cboPrimBack.Value & "')"

DoCmd.SetWarnings True

EDIT: You can stop the user prompts by using SetWarnings = False before the inserts. Then turn the warnings back on after the inserts via DoCmd.SetWarnings True.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

SQL VBA Run-Time Error 3075: Syntax error(missing operator) in query expression

From Dev

SQL VBA Run-Time Error 3075: Syntax error(missing operator) in query expression

From Dev

Run-time error '3075': Syntax error (missing operator) in query expression '[Order Number] = '

From Dev

Seach function in Access syntax error: missing a comma in query expression

From Dev

Access: Runtime error 3075 (missing operator) in SQL update query

From Dev

Compile/Syntax Error: Run-time error 3075: Syntax error in query expression

From Dev

use of comma is causing syntax error

From Dev

Oracle SQL missing comma error

From Dev

BASH Syntax Error - [: missing `]'

From Dev

Javascript syntax error - missing )

From Dev

syntax error: missing ',' before '<'

From Dev

A missing syntax error

From Dev

TSQL Syntax error: missing 'if'

From Dev

Syntax Error: Missing Exponent in Javascript

From Dev

SQL: Syntax error (Missing operator)

From Dev

Syntax Error: Missing Exponent in Javascript

From Dev

sql syntax is missing & error handling

From Dev

Syntax error: Missing ; Before Statement

From Dev

Getting syntax error: unexpected comma, expecting {

From Dev

Delphi 7 Syntax error (comma) in ADO query

From Dev

sudoers syntax error after adding a simple comma

From Dev

ORA-00917: missing comma error

From Dev

SQL error or missing database (near ".": syntax error)

From Dev

error C2143: missing syntax error: missing ';' before '*'

From Dev

Error: ORA-00917: missing comma 00917. 00000 - "missing comma"

From Dev

nftables meter error: syntax error, unexpected saddr, expecting comma or '}'

From Dev

Makefile syntax error. Missing separator

From Dev

MySQL Procedure Syntax Error "Missing END"

From Dev

Syntax error: Missing operand before '=' operator

Related Related

  1. 1

    SQL VBA Run-Time Error 3075: Syntax error(missing operator) in query expression

  2. 2

    SQL VBA Run-Time Error 3075: Syntax error(missing operator) in query expression

  3. 3

    Run-time error '3075': Syntax error (missing operator) in query expression '[Order Number] = '

  4. 4

    Seach function in Access syntax error: missing a comma in query expression

  5. 5

    Access: Runtime error 3075 (missing operator) in SQL update query

  6. 6

    Compile/Syntax Error: Run-time error 3075: Syntax error in query expression

  7. 7

    use of comma is causing syntax error

  8. 8

    Oracle SQL missing comma error

  9. 9

    BASH Syntax Error - [: missing `]'

  10. 10

    Javascript syntax error - missing )

  11. 11

    syntax error: missing ',' before '<'

  12. 12

    A missing syntax error

  13. 13

    TSQL Syntax error: missing 'if'

  14. 14

    Syntax Error: Missing Exponent in Javascript

  15. 15

    SQL: Syntax error (Missing operator)

  16. 16

    Syntax Error: Missing Exponent in Javascript

  17. 17

    sql syntax is missing & error handling

  18. 18

    Syntax error: Missing ; Before Statement

  19. 19

    Getting syntax error: unexpected comma, expecting {

  20. 20

    Delphi 7 Syntax error (comma) in ADO query

  21. 21

    sudoers syntax error after adding a simple comma

  22. 22

    ORA-00917: missing comma error

  23. 23

    SQL error or missing database (near ".": syntax error)

  24. 24

    error C2143: missing syntax error: missing ';' before '*'

  25. 25

    Error: ORA-00917: missing comma 00917. 00000 - "missing comma"

  26. 26

    nftables meter error: syntax error, unexpected saddr, expecting comma or '}'

  27. 27

    Makefile syntax error. Missing separator

  28. 28

    MySQL Procedure Syntax Error "Missing END"

  29. 29

    Syntax error: Missing operand before '=' operator

HotTag

Archive