473,385 Members | 1,912 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,385 software developers and data experts.

I need a little help... INSERT INTO SQL Command

i have a table named tblClanovi
now i would like to make a sql insert into command that will add new record
in the database...

Private Sub btnSpremi_Click()
Dim broj
Dim imepr
broj = Nz(DMax("ClanID", "tblClanovi")) + 1
Me!txtClanBroj = broj
imepr = Me!txtImePrezime
DoCmd.RunSQL "INSERT INTO tblClanovi (ClanID, ImePrezime) VALUES " & broj &
imepr
End Sub

can you help me.. i get
Run-Time error '3134':
Syntax error in INSERT INTO statement

-
Andy
Nov 12 '05 #1
2 5425
"Andy_HR" <andy_no_spam_here@remove_this_xnet.hr> wrote in message
news:c7**********@brown.net4u.hr...
i have a table named tblClanovi
now i would like to make a sql insert into command that will add new record in the database...

Private Sub btnSpremi_Click()
Dim broj
Dim imepr
broj = Nz(DMax("ClanID", "tblClanovi")) + 1
Me!txtClanBroj = br
imepr = Me!txtImePrezime
DoCmd.RunSQL "INSERT INTO tblClanovi (ClanID, ImePrezime) VALUES " & broj & imepr
End Sub


DoCmd.RunSQL "INSERT INTO tblClanovi (ClanID, ImePrezime) VALUES (" & broj
&
"," & imepr & ")"

If either of the column datatypes are text datatypes you will also need to
surround them with single quotes
Nov 12 '05 #2

"John Winterbottom" <as******@hotmail.com> wrote in message
"Andy_HR" <andy_no_spam_here@remove_this_xnet.hr> wrote in message
i have a table named tblClanovi
now i would like to make a sql insert into command that will add new record
in the database...

Private Sub btnSpremi_Click()
Dim broj
Dim imepr
broj = Nz(DMax("ClanID", "tblClanovi")) + 1
Me!txtClanBroj = br
imepr = Me!txtImePrezime
DoCmd.RunSQL "INSERT INTO tblClanovi (ClanID, ImePrezime) VALUES " &

broj &
imepr
End Sub

DoCmd.RunSQL "INSERT INTO tblClanovi (ClanID, ImePrezime) VALUES (" &

broj &
"," & imepr & ")"

If either of the column datatypes are text datatypes you will also need to
surround them with single quotes


tnx its working now :-)

its working... and then i tryed something else and it works.. here it is..

DoCmd.RunSQL ("INSERT INTO tblClanovi (ClanID, ImePrezime) VALUES (" &
Nz(DMax("ClanID", "tblClanovi")) + 1 & "," & "'" & Me!txtImePrezime & "'" &
")")
Nov 12 '05 #3

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

Similar topics

15
by: Jack | last post by:
I have a text file of data in a file (add2db.txt) where the entries are already entered on separate lines in the following form: INSERT INTO `reviews` VALUES("", "Tony's", "Lunch", "Great...
1
by: ADE | last post by:
Hi everyone well from my last post I found what I am looking for I have some code now that transfers files I have added a GUI to it and need some help with two things one my loadtemplate()...
9
by: netpurpose | last post by:
I need to extract data from this table to find the lowest prices of each product as of today. The product will be listed/grouped by the name only, discarding the product code - I use...
25
by: Bjørn T Johansen | last post by:
I need to write a SQL that calculates the interval between a start time and a stop time. This is the easy part. The problem is that I only have the time part, i.e. no date, so how can I be sure to...
13
by: PinkBishop | last post by:
I am using VS 2005 with a formview control trying to insert a record to my access db. The data is submitted to the main table no problem, but I need to carry the catID to the bridge table...
0
by: alivip | last post by:
Is python provide search in parent folder contain sub folders and files for example folder name is cars and sub file is Toyota,Honda and BMW and Toyota contain file name camry and file name corola,...
11
by: lenygold via DBMonster.com | last post by:
I am tryieng to convert our time consuming recursive queries too very efficient queries based on nested set model. The only problem is to convert an adjacency list model into a nested set model,...
2
by: kya2 | last post by:
I am not able to create following store procedure. CREATE PROCEDURE DBSAMBA.InsertDeleteBatch(OUT norows INT ) RESULT SETS 1 LANGUAGE SQL BEGIN part1 DECLARE TOTAL_LEFT INT DEFAULT 0; ...
4
by: CK | last post by:
Good Morning All, Can use use a variable for the FOR clause in a cursor? Example I have DECLARE @a varchar(50), @b varchar(50), @c varchar(50) DECLARE @sql varchar(255) DECLARE @x...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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 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.