About
Pricing
Community
Teams
Start Free Trial
Log in
Keking
asked on
3/14/2012
Compile error on recordset
I am getting a Compile error Expected: End of statement
at the line that reads
strInsert = "INSERT INTO Temp_Input (LOC) VALUES ('"rs2.Fields(1).Value"');
"
with rs2 Highlighted.
Private Sub Command4_Click()
Dim rs2 As New ADODB.Recordset
Dim cnn2 As New ADODB.Connection
Dim cmd2 As New ADODB.Command
Dim strInsert As String
With cnn2
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "Data Source=Y:\0_Sales_Planning
\DataSourc
e\Vendor Attributes\Vendor Agent Attribute\Aegis\Import\Ven
dor Attribute File Irving Ridgepoint.xls;Extended Properties=""Excel 8.0;HDR=NO;IMEX=1;"";"
.Open
End With
Set cmd2.ActiveConnection = cnn2
cmd2.CommandType = adCmdText
cmd2.CommandText = "SELECT * FROM [Ridge Point MA Sales$]"
rs2.CursorLocation = adUseClient
rs2.CursorType = adOpenStatic
rs2.LockType = adLockReadOnly
rs2.Open cmd2
While Not rs2.EOF
strInsert = "INSERT INTO Temp_Input (LOC) VALUES ('"rs2.Fields(1).Value"');
"
Debug.Print strInsert
CurrentDb.Execute strInsert, dbFailOnError
rs2.MoveNext
Wend
End Sub
Microsoft Access
4
2
Last Comment
mbizup
8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
mbizup
3/14/2012
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
mbizup
3/14/2012
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Keking
3/14/2012
ASKER
Thank you for the quick answers!
mbizup
3/14/2012
Glad to help out :)
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck