Connection error only during start-up

P.Degraeva

New member
Local time
Today, 22:49
Joined
Nov 23, 2011
Messages
1
Hi everyone,

I'm trying to make an ADO connection to a csv file. (path and file name stored in string “PathImportDataBanken”, file name in “BestandImportDataBanken”)

Every first time I start up my programme, the programme strands on the 'rs.open'-statement.

the error-screen I'm getting (it's in Dutch):
"Error # -2147467259 De geselecteerde instelling van de sorteervolgorde wordt niet ondersteund door het besturingssysteem."

(In english: "Error # -2147467259 The selected option for sorting is not supported by the operating system.")

Here's the connection-code: (VeldDatumImportDataBanken = date field)


PHP:
Dim cnn As ADODB.Connection
PHP:
[LEFT][COLOR=#000000]Dim rs As ADODB.Recordset
[COLOR=#000000]Dim strSQL As String[/COLOR]
[COLOR=#000000][/COLOR]
[COLOR=#000000]Set cnn = New ADODB.Connection[/COLOR]
[COLOR=#000000]Set rs = New ADODB.Recordset[/COLOR]
[COLOR=#000000]rs.CursorLocation = adUseClient[/COLOR]
[COLOR=#000000][/COLOR]
[COLOR=#000000]cnn.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source=" & _[/COLOR]
[COLOR=#000000]PathImportDataBanken & ";" & _[/COLOR]
[COLOR=#000000]"Extended Properties=""text;HDR=YES;FMT=Delimited(;)"";" & _[/COLOR]
[COLOR=#000000]"Persist Security Info=False"[/COLOR]
[COLOR=#000000]cnn.Open[/COLOR]
[COLOR=#000000][/COLOR]
[COLOR=#000000]strSQL = "SELECT * FROM " & BestandImportDataBanken & "ORDER BY [" _[/COLOR]
[COLOR=#000000]& VeldDatumImportDataBanken & "]"[/COLOR]
[COLOR=#000000][/COLOR]
[COLOR=#000000]rs.Open strSQL, cnn, adOpenDynamic, adLockOptimistic [/COLOR][/LEFT]
[/COLOR]




I only receive the error when opening the programme for the FIRST time only... When I run the code a second or third time, no error appears.

When a change :
strSQL = "SELECT * FROM " & BestandImportDataBanken​

everything works fine from start-up.​

I'm using:
-Visual Basic for applications 7
-MS access 2010 reference to​
• VB for applications
• MS access 14.0 Object Library
• OLE automation
• MS Office 14.0 access database engine object library
• MS VB for applications extensibility 5.3
• MS activeX data objects 6.0 library
-Vista

Your help and Time is appreciated.​

Best Regards,​

F.Degraeve, Belgium​

 

Users who are viewing this thread

Back
Top Bottom