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

Storing Only One Value?

P: n/a
Hi, folks -

I have a control on a form that needs to store a single user-entered
(currency) amount, and store that amount for the next time another
user opens the form and views/updates it.

If I use an unbound control, the number will disappear every time the
form is closed. For the value to stay stored instead, do I really have
to create an entire 1-record table? If so, what control-source syntax
tells the field to look for only one record, and what prevents a user
from accidentally entering a 2nd record into that table and screwing
everything up?

I'm assuming there's a cleaner way to do this - any suggestions?

Thanks!
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On 9 Feb 2004 22:20:56 -0800, sc*************@hotmail.com (screenwriter776)
wrote:
Hi, folks -

I have a control on a form that needs to store a single user-entered
(currency) amount, and store that amount for the next time another
user opens the form and views/updates it.

If I use an unbound control, the number will disappear every time the
form is closed. For the value to stay stored instead, do I really have
to create an entire 1-record table? If so, what control-source syntax
That's the easiest solution, yes.
tells the field to look for only one record, and what prevents a user
from accidentally entering a 2nd record into that table and screwing
everything up?

I'm assuming there's a cleaner way to do this - any suggestions?


No, but there's a way to make this way pretty clean.

First of all, set the form to allow edits, but not additions or deletions.
This way, the user can't add a second record or delete the original record, no
matter what they do. Next, to really lock it down, add an Integer primary key
to the table, and give it a validation rule that only allows the value 0 in
the field. Now, even a developer cannot accidentally add a second row,
because there can only be one row with a PK value of zero, and zero is the
only value allowed.
Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.