Hi,
I have a strange problem that I'm really having a hard time fixing.
My project runs on a PC and uses an Access database on the same PC.
There is a datagrid connected to the database via an ADODC data control.
My code will modify the contents of some fields using the code below.
'==================================
sODBCConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data " & _
"Source=" & path_to_data_source & ";Persist Security Info=False"
Set db_conn = New ADODB.Connection
db_conn.Open sODBCConn
sQLstr = "SELECT * From Main"
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
rs.Open sQLstr, db_conn
rs.AddNew
rs.Fields("Accept").value = False
.... more similar code here ....
rs.Update
rs.Close
Set rs = Nothing
Set db_conn = Nothing
'==================================
Then later in another part of the code I execute the following code I
*sometimes* get an "authentication error".
Conn_str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
path_to_data_source & ";Persist Security Info=False"
Adodc1(1).ConnectionString = Conn_str
Adodc1(1).RecordSource = rec_source
Adodc1(1).Refresh ' Authentication occurs error here - sometimes
'rec_source = a valid SQL string
'==================================
I have all the latest service packs for VB6 and also have the latest JET4
dll
First I thought I might have a race condition between the two code segments
so I tried setting up a timer to later execute the ADODC1 code. That didn't
help.
This code has worked for me before but the big difference here is that the
code above is setting up the ADODC *after* it was done earlier on the same
form. It is part of a test-repeat function I added. I also tried setting
the Adodc1(1).ConnectionString="" and Adodc1(1).RecordSource ="" before
this code executes. No luck.
I think I just don't know enough to understand the error and there is lots
of info on the internet that doesn't seem to apply ot my situation.
Is it possible there is something I can set that will prevent this error?
Thanks, Jennifer
Jennifer Ward - 03 Jul 2008 15:14 GMT
I've been reading....
If I set a password for the database and then used that in my code, would
that bypass the authentication issue ?
Only my code will be accessing the database.
Thanks.
William Vaughn [MVP] - 04 Jul 2008 04:58 GMT
No. The password you pass to JET has no affect on the Windows-based
authentication you need to access (read/write/delete) the database file.

Signature
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________
> I've been reading....
>
[quoted text clipped - 4 lines]
>
> Thanks.
William Vaughn [MVP] - 04 Jul 2008 04:52 GMT
Consider that a heavily pressed JET (Access) DB engine does not write right
away. It waits until the engine is idle. Perhaps you do not have sufficient
rights on the file in question.

Signature
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________
> Hi,
>
[quoted text clipped - 60 lines]
>
> Thanks, Jennifer