By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,635 Members | 911 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,635 IT Pros & Developers. It's quick & easy.

Excel VBA ADO Connect Error required parameters were given a value of more than

P: 1
Prease Help me!

Why Error?

Expand|Select|Wrap|Line Numbers
  1. VBA Code
  2.  
  3.     myFile = ThisWorkbook.FullName
  4.     Set xCn = New ADODB.Connection
  5.     Set xRs = New ADODB.Recordset
  6.     xRs.CursorLocation = adUseClient
  7.     With xCn
  8.         .Provider = "Microsoft.ACE.OLEDB.12.0"
  9.         .Properties("Data Source") = myFile
  10.         .Properties("User ID") = "Admin"
  11.         .Properties("Persist Security Info") = False
  12.         .Properties("Extended Properties") = "Excel 12.0 Macro;HDR=NO;IMEX=1;"
  13.         .Open
  14.     End With
  15.     xSql = "SELECT a.P1, a.P2, a.P3, a.P4, a.P5, a.P6 " & _
  16.             "FROM [Sheet1$A1:F16] as a, [Sheet1$H1:M8] as b " & _
  17.             "WHERE a.P1=b.P1 AND a.P2=b.P2 AND a.P3=b.P3 AND a.P4=b.P4 AND a.P5=b.P5 AND a.P6=b.P6 " & _
  18.             "GROUP BY a.p1,a.p2,a.p3,a.p4,a.p5,a.p6,b.p1,b.p2,b.p3,b.p4,b.p5,b.p6 ; "
  19.     xRs.Open xSql, xCn, adOpenStatic, adLockReadOnly    <====  required parameters were given a value of more than
Jun 13 '12 #1
Share this Question
Share on Google+
1 Reply


zmbd
Expert Mod 5K+
P: 5,397
Make sure that Option Compare Database and
Option Explicit are set as the very first lines in your vba modules.

From the debug menu, comple.

Fix any errors that popup

Then post the exact text of the error and which line in your code the error occurs.

-z
Aug 20 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.