Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default ODBC SQL Query give type mismatch in where clause

Hello Alll,
I am trying to pull data from a SQL server app called Remedy. I
has a ODBC driver that I am using. I am trying to edit an existing se
of code to manipulate it to my conditions. The situation I have is th
existing code will only work for 1 "Base" code in the where clause an
1 Status. I support 60 Bases. I need to configure a Where clause tha
supports 60 Bases. The problem I run in to is every time I go over
bases / status where clauses I run into a type mismatch.

Here is my code can anyone help..

Public Sub Querry()

' Querry of the Remedy Server For Tickets

With Sheet10.QueryTables.Add(Connection:=Array(Array( _
"ODBC;DSN=Remedy;ARServer=" & server
";ARServerPort=5280;UID=" & UserName & ";PWD=" & password
";ARAuthentication=;ARDiaryDescend=1;ARUseUn" _
), Array("derscores=1;ARNameReplace=1;SERVER=NotTheSe rver"))
Destination:=Sheet10.Range("A2"))
.CommandText = Array( _
"SELECT HPD_HelpDesk.Create_Time, HPD_HelpDesk.Case_ID_
HPD_HelpDesk.Status, HPD_HelpDesk.Escalated_, HPD_HelpDesk.Base
HPD_HelpDesk.Assigned_To_Group_, HPD_HelpDesk.Category
HPD_HelpDesk.Type, HPD_HelpDesk.Item," _
, _
" HPD_HelpDesk.Machine_Name_, HPD_HelpDesk.Description
HPD_HelpDesk.Work_Log, HPD_HelpDesk.Requester_Name_
HPD_HelpDesk.Phone_Number, HPD_HelpDesk.Building, HPD_HelpDesk.Floor
HPD_HelpDesk.Room_Cube, HPD_HelpDesk.Network_Jack" & Chr(13) & ""
Chr(10) & "FROM HP" _
, _
"D_HelpDesk HPD_HelpDesk" & Chr(13) & "" & Chr(10) & "WHER
(HPD_HelpDesk.Status<='Resolved') AND (HPD_HelpDesk.Base= 'ABNY')"
Chr(13) & "" & Chr(10) & "ORDER BY HPD_HelpDesk.Case_ID_")
.Name = "Query from AR System ODBC Data Source"
.FieldNames = False
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With

' Sheet7.PivotTables("Count of Case ID").RefreshTable
' Sheet9.PivotTables("MACs").RefreshTable

End Sub

The example only shows 1 Status / Base in the where clause and a
previously stated I need to get the results for 60 bases on th
existing status...

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default ODBC SQL Query give type mismatch in where clause

hi,

<='Resolved'

cannot work, i'd guess. I would suggest that you first test your sql-string
as plain text without any concatenating, variables etc.

regards

arno

"WHERE
(HPD_HelpDesk.Status<='Resolved') AND (HPD_HelpDesk.Base= 'ABNY')" &
Chr(13) & "" & Chr(10)



Reply
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
$ sign in SQL clause in MS Query FredAker Excel Discussion (Misc queries) 1 July 30th 08 10:43 AM
how can i query an sheet with a where clause....from c# code using GAC.Me.Up.baby Charts and Charting in Excel 0 November 30th 05 09:11 PM
type mismatch--how to fix rroach Excel Discussion (Misc queries) 2 July 14th 05 06:23 PM
Database Query -- Data Type Mismatch StephenP Excel Discussion (Misc queries) 0 April 14th 05 07:05 PM
Query Sheet using a WHERE clause? Icemak[_3_] Excel Programming 1 January 7th 04 11:47 PM


All times are GMT +1. The time now is 02:41 PM.

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

About Us

"It's about Microsoft Excel"