By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,062 Members | 1,374 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,062 IT Pros & Developers. It's quick & easy.

How to limit a form to only one record.

P: 1
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.
Apr 5 '10 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 234
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:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)
  2.     Me.DataEntry = True
  3.     Me.txtName = ""
  4.     Me.AllowAdditions = False
  5. 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.
Apr 5 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.