How to give insert command

S

subbu

Hi,
I am trying use insert into() Values() thru code.I am
not able to form one.I have 30 columns to insert

My question is how to split the line while writing the
query and how to form the query

regds
subbu
 
D

Dan Artuso

Hi,
That's a pretty general question so I'll just give you something out of
one of my projects:

strSql = "Insert Into Machines (MachineName,MachineIp,OsVersion," & _
"MacAddress,ThirdOctet,FourthOctet) Values(" & _
"'offline','" & ip & "',4,'unavailable'," & intThirdOctet & "," & intFourthOctet & ")"

Delimit strings with '
Dates with #
and numbers need no delimiters

ALWAYS check your string with either:
MsgBox strSql
OR
Debug.Print strSql

before you execute it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top