How to limit a form to only one record.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Elef
    New Member
    • Apr 2010
    • 1

    How to limit a form to only one record.

    Hi
    I have a form let's say for a real estate agent. He fills the form, with his name, address, etc., etc. He can also attach a picture of himself, a property, whatever.

    My Problem
    When all the information is filled in, I DO NOT want the option of moving to the NEXT record.
    This is for a "one time" record.
    I have Googled to no avail of finding a solution. And given that databases are for adding NEW entries, I am beginning to wonder if what I want is actually possible. I see solutions for a myriad of problems, but I haven't had any luck finding a solution for this.
    Thanks
  • topher23
    Recognized Expert New Member
    • Oct 2008
    • 234

    #2
    It looks like what you want is for the user to add a single new record, but no more. Here's the option I use.

    Suppose you have a form called frmInfo with a field called txtName.
    In the form's On Open event, put the following code:

    Code:
    Private Sub Form_Open(Cancel As Integer)
        Me.DataEntry = True
        Me.txtName = ""
        Me.AllowAdditions = False
    End Sub
    This sets the form to data entry only (no editing old records), puts an empty string into a field in order to populate the record, then makes it so you can't add any more records by setting AllowAdditions to False. The user can then put any info they want into the current record, but can't do anything else.

    Comment

    Working...