Welcome to SPN

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

Sign Up Now!
  1. Guest ji, please consider donating today!
      Become a Supporter    ::   Make a Contribution   
    Monthly Recurring Target: $300 :: Achieved: $95

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
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page