Results 1 to 4 of 4
  1. #1
    Join Date
    May 2003
    Location
    UK
    Posts
    233

    Unhappy Unanswered: Limit number of records in a table to one

    I want to limit the number of records in a table to one. I have set up a table that holds a user name when they access a particular form.

    I want this form to be accessed by only one user at a time, hence why I want to limit a table to one record.

    I need to this table, to record time of transaction and the user who has imput the records

    can anyone help me, or advise of a way of putting this restriction in place.

  2. #2
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    why don't you just add a field for the user and the time in the table that holds the records and when you save a record just add the currentuser and the date/time to the other field?

    It is my understanding that you want to track a record's edits/updates by the user

    this my be the easiest way other than creating a logfile (we do that here)
    or using functions to see if another user is in the form and then locking out other users.

    Let me know if this helps and if I missed something I will do what I can to get it right next time

  3. #3
    Join Date
    May 2003
    Location
    UK
    Posts
    233
    Logging the user date/time is no problem, I have that undr control.

    What I need is to prevent anybody entering this form whilst it is being used by some other user.

    How can I use the functions to lock out other user from the form?

  4. #4
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    dim rs as dao.recordset
    set rs = currentdb.openrecordset("<tablename>")
    if rs.count>1 then
    msgbox "form locked"
    else
    docmd.openform xxx
    endif

    then just have the form delete the record on closing
    Last edited by m.timoney; 05-28-03 at 06:54.
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •