LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Trying to Modify Excel code; Pointing to SQL Server Instead of Acc


I played with the code he

http://www.rondebruin.nl/accessexcel.htm

Got that working quick, but now I'm trying to modify the to point to my SQL
Server, and having a heck of a time getting it going.

In Excel, I have set a reference to €˜Microsoft ActiveX Data Objects 2.8
Library

The code in €˜MainMacro is the same. I changed Sub Test4 a bit; now like this:

Sub Test4()
Dim con As New ADODB.Connection
With Sheets("test")
con.Open "Provider=SQLOLEDB;Data Source=LAPTOP\SQL_EXPRESS;Initial
Catalog=;Integrated Security=SSPI;"
GetDataFromAccess "Orders", "ShipCountry", "=", Sheets("test").Range("G6"), _
"ShipVia", "=", Sheets("test").Range("F6"), _
"", "=", "", _
"Freight", "", "100", _
"Freight", "<", "300", _
"", "=", "", _
"", "<=", "", _
Sheets("test").Range("A8"), _
"%", True, True
con.Close
Set con = Nothing
End With
End Sub


When I run the code I get this error: €˜Compile Error; Type Mismatch
This is the line that errors:
"%", True, True

I know the wildcard in SQL Server is the %.
What am I doing wrong?


Thanks, in advance, for the help!!

Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA code to modify Excel spreadsheet and then email it Glenn Suggs Excel Programming 2 September 16th 09 11:09 AM
Unable to modify 2007 file on NAS server shared drive shyam joshi Excel Discussion (Misc queries) 0 August 16th 09 08:05 PM
Modify Excel (2003) code for Network environment JMay Setting up and Configuration of Excel 1 March 9th 09 01:05 PM
Excel spreadsheet still pointing to old server after server move Yemi Excel Programming 0 June 26th 08 07:43 AM
Modify ADD ROWS Code - Excel 2003 [email protected] Excel Programming 4 August 17th 06 08:59 PM


All times are GMT +1. The time now is 06:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"