Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Access database error

I have sporadically found an error when accessing an access database from
Excel VBA, sometimes I get double entries (lines) in Excel when there is only
one entriy in Access database. The double entriy I see are just a copy of an
existing line.

Database are located in house on network drive.

Question: Does anyone know the cause of this error / behaviour? The solution
today is to verify that no double entries exists, and if it does, promt
operator to re-run macro until it pass.

VBA Code:
With ActiveSheet.QueryTables.Add(Connection:=Array(Arra y( _
"ODBC;DSN=MS Access Database;DBQ=" & FileToOpen & ";FIL=MS
Access;MaxBufferSize=2048;PageTimeout=5;" _
)), Destination:=Range("A1"))
.CommandText = Array( _
"SELECT BOAT.ShortID, BOAT.Rev, BOAT.TestGroup, BOAT.MPPoint,
BOAT.MPDescription, BOAT.LtLow, BOAT.LtHigh, BOAT.Meas, BOAT.Unit,
BOAT.Cause, " _
, _
"BOAT.CompName, BOAT.Action, BOAT.Comments, BOAT.TSResp, BOAT.Pos,
BOAT.CompNumb, BOAT.RepairHistory, BOAT.RepCnt, BOAT.Status, BOAT.DateUpdate,
" _
, _
"BOAT.IR, BOAT.DateStamp, BOAT.ID, BOAT.IDNumber, BOAT.MPGroup,
BOAT.CustomerCom, BOAT.Loc FROM BOAT ORDER BY BOAT.IDNumber, BOAT.Loc")

.Name = "Query from MS Access Database"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = False
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False

End With
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
Error Message - accessing an Access database tkirchoff15 Excel Programming 0 March 5th 07 09:49 PM
Error Querying Access Database From Excel [email protected] Excel Programming 0 December 12th 06 11:03 AM
Error while populating a combobox from Access database shivboy[_13_] Excel Programming 1 June 29th 06 11:04 AM
Excel error while trying to import data from an Access database - MSQRY32.exe has generated errors X_HOBBES Excel Discussion (Misc queries) 0 March 15th 05 06:46 PM
Excel VBA Access Database Error Ryan Excel Programming 0 July 8th 04 01:33 PM


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

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"