How to give insert command

  • Thread starter Thread starter subbu
  • Start date Start date
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
 
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.
 
Back
Top