Hi Folks. I have a simple insert statement only four fields. The last field "Table" is the problem child. IF I take it out and the associated value "Me.txtTempTab" the insert statement works. Image of code also attached. Any assistance would be greatly appreciated. Thank you in advance... -
DoCmd.RunSQL "INSERT INTO tblScrBldSched " & _
-
"( OrderNo, Tech, SchedDate, Table )" & _
-
"VALUES ('" & Me.cmbSTBT1A.Column(0) & "' ," & _
-
" '" & Me.cmbScrTechT1A.Column(0) & "' ," & _
-
" '" & Me.txtSchedDate & "' ," & _
-
" '" & Me.txtTempTab & "' );"
-
-
First, try a couple of minor adjustments: - DoCmd.RunSQL "INSERT INTO tblScrBldSched " & _
-
"([OrderNo], [Tech], [SchedDate], [Table])" & _
-
" VALUES ('" & Me.cmbSTBT1A.Column(0) & "' ," & _
-
"'" & Me.cmbScrTechT1A.Column(0) & "' ," & _
-
"'" & Me.txtSchedDate & "' ," & _
-
"'" & Me.txtTempTab & "');"
3 2357 ADezii 8,834
Recognized Expert Expert
First, try a couple of minor adjustments: - DoCmd.RunSQL "INSERT INTO tblScrBldSched " & _
-
"([OrderNo], [Tech], [SchedDate], [Table])" & _
-
" VALUES ('" & Me.cmbSTBT1A.Column(0) & "' ," & _
-
"'" & Me.cmbScrTechT1A.Column(0) & "' ," & _
-
"'" & Me.txtSchedDate & "' ," & _
-
"'" & Me.txtTempTab & "');"
Thanks ADezii. That worked! Though I'm not sure why the brackets are needed in this case. Can you help me understand why?
The brackets are only needed for reserved words and names with spaces or weird characters.
Also, a date value should be inserted as a string expression for the date value, not as text, thus: - DoCmd.RunSQL "INSERT INTO tblScrBldSched " & _
-
"( OrderNo, Tech, SchedDate, [Table] ) " & _
-
"VALUES ('" & Me.cmbSTBT1A.Column(0) & "', " & _
-
"'" & Me.cmbScrTechT1A.Column(0) & "', " & _
-
"#" & Format(Me!txtSchedDate.Value, "yyyy\/mm\/dd") & "#, " & _
-
"'" & Me.txtTempTab & "');"
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Tim::.. |
last post by:
Can someone please tell me why I keep getting the following error from the
code below!
Error: INSERT statement conflicted with COLUMN FOREIGN KEY constraint...
|
by: jinhy82 |
last post by:
Hi! I am currently creating a Registration form which contained: UserID
Password, FirstName and LastName.
These details would be inserted into Ms Access when I click submi
button. But I...
|
by: Ed Pisa |
last post by:
Hello,
I have been working with this problem now for several days. I can delete and Update my data but I can not get it to insert a new record. I receive the syntax error insert into. I am not...
|
by: Ed Pisa |
last post by:
Hello,
I have been working with this problem now for several days. I can delete and Update my data but I can not get it to insert a new record. I receive the syntax error insert into. I am not...
|
by: RameshKumar |
last post by:
'Register User Form
Imports System.Data.OleDb
Public Class RegisterUser
‘ Variables Decleration
Public Con As OleDbConnection
Public Cmd As OleDbCommand
Public Dr As...
|
by: NikArt |
last post by:
I get syntax errors while trying to copy all data from a query into a table using INSERT INTO and SELECT.
Here are the lines:
INSERT INTO LoadTBTemp])]
SELECT Data1
FROM LoadTB
...
|
by: sonurathore |
last post by:
pls help me
this code error geting for syntax error insert into statement
pls check it
string SqlString = "INSERT INTO CUSTOMER...
|
by: Olabode |
last post by:
hello guys
I am new here and in programing
I have this program that I am designing am using Visual studio 2010 and ms access 2010. am using ms access as a data base i have successfully designed...
|
by: asyrofifarel |
last post by:
#include<stdio.h>
#include<conio.h>
main()
{
int hp,jp,ap,jb,ht
float ht;
printf("-->LankBuana Audio System<--");
printf("\n======================");
printf("\nMASUKAN NAMA PEMBELIAN = ");...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |