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!

locking the table or row

Status
Not open for further replies.

99mel

Programmer
Oct 18, 1999
379
GB
Right, i basically have two vb programs which connect to a local db using adodb. These local dbs have linked tables to a main db on the server.

I use sql queries to select/insert and update data.

The vb progs select the value from a lookup table but i need this table or row (theres only the one record) to lock so the other program can not select the value at the same time.

Is this possible by using a sql query or something similar?
 
Hi,

not sure if this helps as its written for DAO rather than ADO (as I don't think the equivalent exists in ADO).

There shouldn't be any reason why you can't use it if you add DAO to your references. I wouldn't usually mix the 2 - but hey, it works...

Function get_parameter() As Variant
' call this code from your main sub to return your parameter
' (as a variant in this case)
Dim db As DAO.Database
Dim rstParameter As DAO.Recordset

Set db = DBEngine(0)(0)
Set rstParameter = db.OpenRecordset("tlkpParameter", , dbDenyRead)
With rstParameter
If Not .EOF Then
get_parameter = .Fields(0) ' assumes parameter is in the first field
Debug.Print get_parameter
' if record doesn't exit then do something, not sure what...
End If
.Close
End With

End Function
 
HI,
Iam assigning record set open in ado to datasheet opened with dao having may fields...and in which only one field needs to be locked..how can i do that?????
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top