Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't open a recordset with recordlocks argument

Status
Not open for further replies.

mdav2

Programmer
Aug 22, 2000
363
GB
I am tring to open a recordset that allows pessimistic record locking. It returns the error "INVALID ARGUMENT" when running the "set rstSender..." line. The code will open the recordset if I remove the "dbPessimistic" from the statement (along with the commas).

Any help would be most appreciative.

' This creates the recordset
Dim dbs As Database
Dim sqlstr As String

' rstSender is declared as a public recordset
' The rstSender recordset is a based on the t_person table details
Set dbs = CurrentDb
sqlstr = "SELECT * FROM letter"
Set rstSender = dbs.OpenRecordset(sqlstr, dbOpenDynaset, , dbPessimistic)

 
I have discovered that you need to pass a 0 into the options argument for this to work.

Pessimistic locking also seems to lock the whole recordset, not just the record.

Does anyone know if it is possible to have a recordset that you can lock single records on?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top