Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Data Mismatch Error when adding 2 new fields

Hi,

I've inherited an existing excel sheet and am "just" adding 2 extra fields
into the SELECT which is grabbing info from a Timberline database and
throwing it in an excel sheet.

The working code is this (existing code is working fine):

Set NewSheet = Worksheets.Add
NewSheet.Name = "Tax"
Set TaxSht = Worksheets("Tax")

Worksheets("Tax").Activate
'SendKeys LoginVar & "{TAB}" & PasswordVar & "{ENTER}", False
With ActiveSheet.QueryTables.Add(Connection:=Array(Arra y( _
"ODBC;DSN=Timberline Data
Source;UID=TAKENOUT;PWD=TAKENOUT;DBQ=T:\TAKENOUT;C ODEPAGE=1252;MaxColSupport=1536;DictionaryMode" _
),
Array("=0;StandardMode=0;MaxColSupport=1500;Shorte nNames=0;DatabaseType=1;")), _
Destination:=Worksheets("Tax").Range("A1"))
.CommandText = Array( _
"SELECT CURRENT_ART_TRANSACTION.Job, CURRENT_ART_TRANSACTION.Amount"
& Chr(13) & "" & Chr(10) & _
"FROM CURRENT_ART_TRANSACTION CURRENT_ART_TRANSACTION" & Chr(13) &
"" & Chr(10) & _
"WHERE CURRENT_ART_TRANSACTION.Job='" &
Worksheets("WIP").Cells(WIPRow, 2) & "'" & Chr(13) & "" & Chr(10) & _
"ORDER BY CURRENT_ART_TRANSACTION.Job")
.Name = "qry_Tax"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With

----------------------------------------

Now when I add 2 more fields to the SELECT statement it gives me a Data
Mismatch error and I have no idea why. The 2 extra fields have text in them.

New Line:
"SELECT CURRENT_ART_TRANSACTION.Job, CURRENT_ART_TRANSACTION.Amount,
CURRENT_ART_TRANSACTION.Transaction_Type,
CURRENT_ART_TRANSACTION.Amount_Type" & Chr(13) & "" & Chr(10) & _

I am certainly not an Excel VBA expert and just dont know why 2 extra fields
in a brand new worksheet would cause this error.

Anyone have any thoughts?
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
Adding multiple data fields from time based data. JMK Excel Discussion (Misc queries) 1 July 27th 07 10:59 PM
Conditional Formatting - Run Time Error '13' Type Mismatch Error ksp Excel Programming 0 July 11th 06 07:06 AM
Type Mismatch Error when getting data from another workbook Tony Zappal Excel Programming 2 January 12th 05 10:29 PM
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error rdavis7408 Excel Programming 1 August 25th 04 03:54 AM
Copying data to another worksheet gives "Type Mismatch" error TB[_3_] Excel Programming 6 July 28th 03 12:44 PM


All times are GMT +1. The time now is 07:21 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"