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

Subscript out of range error

P: 5
Hello, I keep getting subscript out of range error when connection to the database and I can't figure out why, there is already an existing connection with the table. Any help would be highly appreciated, thank you!

Expand|Select|Wrap|Line Numbers
  1.  
  2. With ActiveWorkbook.Connections("mnlsapp02 SLP B10Data") _
  3.         .OLEDBConnection
  4.         .BackgroundQuery = True
  5.         .CommandText = Array( _
  6.         "SELECT * FROM dbo.B10Data WHERE SalesPeriod = '" & Period & "'")
  7.         .CommandType = xlCmdSql
  8.         .Connection = Array( _
  9.         "OLEDB;Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Data Source=mnlsapp02;Use Procedure for Prepare=1;Auto T" _
  10.         , _
  11.         "ranslate=True;Packet Size=4096;Workstation ID=MNLW692;Use Encryption for Data=False;Tag with column collation when possible=Fals" _
  12.         , "e;Initial Catalog=SLP")
  13.         .RefreshOnFileOpen = False
  14.         .SavePassword = False
  15.         .SourceConnectionFile = ""
  16.         .SourceDataFile = ""
  17.         .ServerCredentialsMethod = xlCredentialsMethodIntegrated
  18.         .AlwaysUseConnectionFile = False
  19.         '.ServerFillColor = False
  20.         '.ServerFontStyle = False
  21.         '.ServerNumberFormat = False
  22.         '.ServerTextColor = False
  23.     End With
  24.  
May 20 '14 #1
Share this question for a faster answer!
Share on Google+

Post your reply

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