
Pessimistic Recordlocks Access --> SQL Server 6.5
Hi,
I was trying to create a testform that is able to pessimistic lock a
record through MS-Access on a SQL Server 6.5 Table.
It work fine. BUT, as always there is a BUT:
When using the OpenConnection-Command in MS-Access it always askes me to
perform the login on the SQL Server, even if the
dbDriverCompleteRequired option is turned on. I want i to connect
automatically through the ConnectionString. (witch probably is wrong)
I have a file dns called "data.dns"
The SQL Server database is called "DataSQL"
Login: sa
Passw: <<none>>
And the table where i want to lock the record in is named "MASTERTable"
In the testform i hav 2 buttons:
One prepares access to edit the record and starts editing it.
The other one updates the record and closes everything.
This is the code for the buttons:
Private Sub LockODBCRecord_Click()
Set wrkODBC = CreateWorkspace("ODBCWorkSpace", "admin", "",
dbUseODBC)
Set conODBC = wrkODBC.OpenConnection("ODBCConnection",
dbDriverCompleteRequired, ,
"ODBC;DATABASE=DataSQL;UID=sa;PWD=;DSN=Data;")
Set RecSet = conODBC.OpenRecordset("MASTERTable", dbOpenDynaset, 0,
dbPessimistic)
RecSet.Move 5
RecSet.Edit
Me![Locked] = True
End Sub
Private Sub UnLockODBCRecord_Click()
RecSet.Update
RecSet.CLOSE
conODBC.CLOSE
wrkODBC.CLOSE
Me![Locked] = False
End Sub
Please Help me out, by replying to these newsgroups.
(I do NOT have an email address...)
Greatings,
Boelen Werner
CAT Logistics
Belgium