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

How to prevent selecting duplicate records in a listbox.

P: n/a
I have a listbox where the user selects only one value at a time. The
problem is that once the user selects the value and the record is
updated in the table, they can reselect the same value again. I do
not want this to happen. Your input is greatly appreciated.
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

Would it be possible to determine from the database if the record has been
updated already ? If so, it would be possible to use the AfterUpdate event.
In there you could change the recordsource of the list box so that the
record is excluded that has been changed already.

If not and you really want to do this, you could add a flag to the table. On
opening the form, all flags are cleared. On changing, the flag is set, and
the recordset is changed.
Alternatively, you could add a selection table that is emptied on opening
the form, and is filled with all the record ID's of the changed records (one
ID added after each record update). Change the list box recordset to SELECT
[x] FROM [y] WHERE [Id] NOT IN (Select [id] From [SelectionTable]).

Just play around a bit..

Bas Hartkamp.

** Computers can do ANYTHING It's just a matter of programmers' persistence
**
Fatou <fa*****@yahoo.com> schreef in berichtnieuws
a2**************************@posting.google.com...
I have a listbox where the user selects only one value at a time. The
problem is that once the user selects the value and the record is
updated in the table, they can reselect the same value again. I do
not want this to happen. Your input is greatly appreciated.

Nov 12 '05 #2

P: n/a
You will need some method to determine which records have been updated
(within the time limits you decide... perhaps "this execution of the
database") and select only those which have not been for your listbox.
Obviously, this will require a requery of the list box after you
update.

Perhaps an Updated field in the records, set when you update, and
cleared when you shut down the database application would do what you
want.

Larry Linson
Microsoft Access MVP

fa*****@yahoo.com (Fatou) wrote in message news:<a2**************************@posting.google. com>...
I have a listbox where the user selects only one value at a time. The
problem is that once the user selects the value and the record is
updated in the table, they can reselect the same value again. I do
not want this to happen. Your input is greatly appreciated.

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.