Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Record Locking

Discussion in 'Information Technology' started by Wayne & Kerri Anne, Jul 28, 2006.

Tags:
  1. Wayne & Kerri Anne

    Wayne & Kerri Anne
    Expand Collapse
    Guest

    Hi All

    Is there a way of locking just one record in a access 97 database.

    I would like to do this because i have written a vb6 program and if the user
    deletes all records then they cause an error because there is no records in
    the database havn't found a fix for that yet thats why I am asking.


    Kind Reagrds
    Wayne
     
  2. Loading...


  3. Allen Browne

    Allen Browne
    Expand Collapse
    Guest

    You cannot place a permanent lock on a single record.

    Your code does need to check whether there are records to deal with. The
    solution would be to change the code so it copes with no records, rather
    than to force the database to always have records.

    For example, if you OpenRecordset, it is very easy to check the RecordCount
    property. The property will be 0 of there are no records, 1 if a record was
    found, or more than 1 if many records were successfuly loaded at once
    (typically on a Table type recordset.)

    If you use ADO recordsets, it could also be -1 for the types where it does
    not know if there are records, but let's ignore that and give a DAO example:
    Set rs = db.OpenRecordset("Table1", dbOpenDynaset)
    If rs.RecordCount > 0 Then
    'Put your code in here.
    End If

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "Wayne & Kerri Anne" <ker.way@bigpond.net.au> wrote in message
    news:e0eUz0egGHA.3652@TK2MSFTNGP02.phx.gbl...
    >
    > Is there a way of locking just one record in a access 97 database.
    >
    > I would like to do this because i have written a vb6 program and if the
    > user deletes all records then they cause an error because there is no
    > records in the database havn't found a fix for that yet thats why I am
    > asking.
    >
    >
    > Kind Reagrds
    > Wayne
     

Share This Page