PC Review


Reply
Thread Tools Rate Thread

Data Mismatch Error when adding 2 new fields

 
 
=?Utf-8?B?THl0aGFuZHJh?=
Guest
Posts: n/a
 
      5th Dec 2006
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(Array( _
"ODBC;DSN=Timberline Data
Source;UID=TAKENOUT;PWD=TAKENOUT;DBQ=T:\TAKENOUT;CODEPAGE=1252;MaxColSupport=1536;DictionaryMode" _
),
Array("=0;StandardMode=0;MaxColSupport=1500;ShortenNames=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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data mismatch error Chris S Microsoft Access Queries 2 10th Feb 2010 06:20 PM
Auto Fill Form Fields Type Mismatch Error DaveAP Microsoft Access 2 30th Jul 2008 12:36 PM
Error data mismatch ?? Daniel Microsoft Excel Programming 3 2nd Jan 2008 10:47 PM
3464 mismatch error on Query depending on the number of fields =?Utf-8?B?bWFzc2ltbw==?= Microsoft Access Queries 0 11th May 2007 01:52 PM
Data Type Mismatch Error on 'Yes/No' fields in Query D Burke Microsoft Access Queries 2 15th Jul 2003 12:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:37 AM.