problem with Dev Ashish table reconnect code

A

Aivars

Hello,
I am strugling to get http://www.mvps.org/access/tables/tbl0010.htm
code to work in my case. The code runs with the follwing errors: Error
#: 3070 The microsoft office access database engine does not recognize
'TableName' as a valid field name or expression

And then it end up in endless errors which can only be stopped by cntrl
+alt+break and the stopped. Error #: 10 - this array is fixed or
temporarily locked.

I start the code in immediate window with fReconnectODBC ENTER

I have changed "qc03" to my DSN but I have no serevr name in ODBC.INI
in registry. May be that is a problem?
What am I supposed to put in as Server value?
'You can follow the same steps to check for multiple DSNs
strTmp = fReturnRegKeyValue(HKEY_CURRENT_USER, _
cREG_PATH & "\qc03", "Server")
If strTmp = vbNullString Then Err.Raise cERR_NODSN

Maybe I am starting the code wrong way?
What can be a problem here?

Thanks
Aivars
 
D

Douglas J. Steele

I think the Error 3070 is caused by a mistake in Dev's code: I think it
should be

rs.FindFirst "LocalTableName='" & .strTableName & "'"

To what DBMS are you trying to connect that there aren't Server entries
associated with the DSN? Realistically, though, those first few lines are
strictly to check that the DSN actually exists on the machine. You should be
able to use some other approach for determining that.

On the other hand, you might consider going DSN-less, and eliminating DSNs
completely. I show one way to do that at
http://www.accessmvp.com/djsteele/DSNLessLinks.html
 
A

Aivars

Thanks Douglas,

It works now!

LocalTableName was a problem! When I started stepping carefully
through the code it showed up.

And in my case I am linking to Interbase through Firebird driver and
registry entry to Interbase server is called Dbname in registry.
Will try your approach with DSN-less later.

Thanks again

Aivars
 
Top