troubleshooting Question

Inserting data from Excel into SQL database table

Avatar of rckrch
rckrchFlag for United States of America asked on
Microsoft SQL ServerMicrosoft Excel
34 Comments3 Solutions406 ViewsLast Modified:
I am trying to use the insert command to enter data as a new record into a table in SQL 2005.  I get an error 'Object Required'.  Attached is a snipet of the code.

Thanks in advance.
varConnection = "ODBC;DSN=CLD;UID=CLD;PWD=cld;APP=Microsoft Office 2003;WSID=SID14412"  ';DATABASE A=CLD;TABLE=dbo.Data"'

        With varConnection
            .CommandText = "INSERT INTO CLDTolerances (KD_TOL, Low_Target, Low_LowerTol, Low_UpperTol, Low_Deflection, Nom_Target, Nom_LowerTol, Nom_UpperTol, Nom_Deflection, Upp_Target, Upp_LowerTol, Upp_UpperTol, Upp_Deflection, TolPercent, Tol2N, TolInput, Date_Time"                            ''6/1/2010 00:00:00'"
            .CommandText = "VALUES (VALKD, VALLow_Target, VALLow_LowerTol, VALLow_UpperTol, VALLow_Deflection, VALNom_Target, VALNom_LowerTol, VALNom_UpperTol, VALNom_Deflection, VALUpp_Target, VALUpp_LowerTol, VALUpp_UpperTol, VALUpp_Deflection, VALTolPercent, VALTol2N, VALTolInput, VALDate_Time"
            .Name = "Query from 159.157.10_1"
            .RefreshStyle = xlOverwriteCells
            .Refresh BackgroundQuery:=False
        End With

Open in new window


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 34 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 34 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros