| re: I need a little help... INSERT INTO SQL Command
"John Winterbottom" <assaynet@hotmail.com> wrote in message[color=blue]
> "Andy_HR" <andy_no_spam_here@remove_this_xnet.hr> wrote in message[color=green]
> > i have a table named tblClanovi
> > now i would like to make a sql insert into command that will add new[/color]
> record[color=green]
> > 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 " &[/color][/color]
broj[color=blue]
> &[color=green]
> > imepr
> > End Sub
> >[/color]
>
> DoCmd.RunSQL "INSERT INTO tblClanovi (ClanID, ImePrezime) VALUES (" &[/color]
broj[color=blue]
> &
> "," & imepr & ")"
>
> If either of the column datatypes are text datatypes you will also need to
> surround them with single quotes[/color]
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 & "'" &
")") |