Issue with bound combo box values...

B

Brad Pears

I have a project I recently converted to Access 2000 from dbaseIV. The user
has been collecting data since the 70's (before dbase, it was obviously
something else) in order to provide statistical analysis to determine needs.
This particular system is fairly straight forward. They are simply
collecting data and storing codes relating to various circumstances and
incidents in a database on individuals supported by the agency. Recently
they went through a "code/description" review which saw them do away with
some codes, create new codes etc... etc.. They do however, still need to
retain the old codes in the database though.

To facilitate this type of thing (as it is something they will likely go
through every once in a while) I added a boolean field called "Show In List"
to the system "codes" table and it's default is set to true for each code.
As codes become irrelevant, they simply uncheck the "ShowInList" field and
that code is no longer displayed in the combo box when the user is entering
new data into the main entry form. The old code is still maintained as it
was in the database but they no longer are able to add that old code when
entering new data. For reporting however, I DO give them the ability to
select ALL codes, whether the SHOWINLIST indicator is set or not. This
allows them to still report and generate stats on old data.

Ok, now that you have the jist of what the application is doing, here is the
problem. Because the various bound "codes" combo boxes have a select clause
that excludes all codes where SHOWINLIST is false, each time a record is
displayed that has a code in it that does not exist in the combo box
recordset, the code is "blanked" out and of course confuses the user as they
think that nothing has been entered there...

To get around this I tried changing the select clause so that all codes are
by default selected until that control has focus. Then, in the "got focus"
event for each combo box, I reset the record source so that it then
excludes the old codes by only selecting those rows where "showinlist" is
true. On the "lost focus" event for each combo box, I then reset the
recordsource to select all records again (exclude the "showinlist = true"
where clause) . This works ok and causes old codes to also be displayed in
the lists but causes some crazy behaviour if the user happens to click on
existing rows in the combo box!

I'd like to rethink this whole thing and redo it. There must be a better
way. Should I not make the combo boxes "bound" possibly and instead handle
the displaying and saving of the code data within the combo boxes manually
using the "on current" and various "update" events of the form perhaps?

What would be the best way to approach this issue??

Thanks,

Brad
 
B

Brad Pears

Sorry Marshall, I think I may have accidentally deleted that thread (that's
why I reposted this one) and hence did not get an opportunity to read the
response you left ... Would it be possible for you to repost your reply for
me to this thread? I am truly sorry!

Much appreciated!!

Brad

Marshall Barton said:
See your earlier thread with this question.
--
Marsh
MVP [MS Access]


Brad said:
I have a project I recently converted to Access 2000 from dbaseIV. The
user
has been collecting data since the 70's (before dbase, it was obviously
something else) in order to provide statistical analysis to determine
needs.
This particular system is fairly straight forward. They are simply
collecting data and storing codes relating to various circumstances and
incidents in a database on individuals supported by the agency. Recently
they went through a "code/description" review which saw them do away with
some codes, create new codes etc... etc.. They do however, still need to
retain the old codes in the database though.

To facilitate this type of thing (as it is something they will likely go
through every once in a while) I added a boolean field called "Show In
List"
to the system "codes" table and it's default is set to true for each code.
As codes become irrelevant, they simply uncheck the "ShowInList" field and
that code is no longer displayed in the combo box when the user is
entering
new data into the main entry form. The old code is still maintained as it
was in the database but they no longer are able to add that old code when
entering new data. For reporting however, I DO give them the ability to
select ALL codes, whether the SHOWINLIST indicator is set or not. This
allows them to still report and generate stats on old data.

Ok, now that you have the jist of what the application is doing, here is
the
problem. Because the various bound "codes" combo boxes have a select
clause
that excludes all codes where SHOWINLIST is false, each time a record is
displayed that has a code in it that does not exist in the combo box
recordset, the code is "blanked" out and of course confuses the user as
they
think that nothing has been entered there...

To get around this I tried changing the select clause so that all codes
are
by default selected until that control has focus. Then, in the "got focus"
event for each combo box, I reset the record source so that it then
excludes the old codes by only selecting those rows where "showinlist" is
true. On the "lost focus" event for each combo box, I then reset the
recordsource to select all records again (exclude the "showinlist = true"
where clause) . This works ok and causes old codes to also be displayed in
the lists but causes some crazy behaviour if the user happens to click on
existing rows in the combo box!

I'd like to rethink this whole thing and redo it. There must be a better
way. Should I not make the combo boxes "bound" possibly and instead handle
the displaying and saving of the code data within the combo boxes manually
using the "on current" and various "update" events of the form perhaps?

What would be the best way to approach this issue??

Thanks,

Brad
 
M

Marshall Barton

What I do in this kind of situation is to place a text box
directly on top of the combo box's text part. Bind the text
box to the the same field as the combo box so it will
display the field value regardless of the combo box's row
source. To prevent users from editing data in the text box,
use it's GotFocus event to set the focus to the combo box.
The combo box will automatically be brought to the front
when it receives the focus.
 
B

Brad Pears

Thanks for that Marshall... Seems like a pretty clever approach. I'll give
it a shot.

Brad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top