--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"Bob A." <a...@me.com> wrote in message
news:I7MJf.35102$H71....@newssvr13.news.prodigy.com...
"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:%23RkIExP...@tk2msftngp13.phx.gbl...
"Bob A." <a...@me.com> wrote in message
news:dG%Lf.61004$PL5....@newssvr11.news.prodigy.com...
It's fairly complicated to explain (this is actually part of my February,
2006 "Access Answers" column in Pinnacle Publication's "Smart Access".
Unfortunately, under the terms of my contract with them, I'm not allowed to
reprint articles until 6 months after they print them...)
The basic problem is that while you may think there are multiple combo boxes
on the form, Access only maintains a single recordset for all of the combo
boxes on the form, rather than one recordset for each combo box. If the
underlying recordset isn’t relevant to the specific record being looked at,
the combo box will not contain the necessary record, and you’ll get blanks
displayed instead of values.
There is a fairly simple work-around, though.
Recognize that there are two reasons for the combo box. One reason, of
course, is to allow the user to select from a list that’s customized based
on other selections made. If you look in the accompanying database, you’ll
see that even though not all of the values are being shown in the form, it’s
still possible to use the combo box to select a value for a particular row.
The other reason for the combo box is to handle the fact that the underlying
table only contains a foreign key pointing to the desired entry in some
other table. The combo box allows you to translate that foreign key to
something a little more meaningful. This is the function that’s failing in
the continuous view.
What you can do to get around this problem is ensure that the underlying
recordset of the form contains not only the foreign key value, but also the
desired description. You do this by creating a query that joins together the
underlying table and whatever other table(s) contain the description, and
using that query as the form’s recordset.
Once you’ve got the description available to you in the form, the question
is how to display it. The “trick” is to have a bound text box that displays
the description, and place it right on top of the combo box on your form.
Make the text box marginally narrower than the combo box (I find that a
difference of 250 twips, which is about 0.17” or 0.44 cm, works well). Put
some code in the text box so that when the user enters the text box, the
combo box is refreshed (to ensure that it’s based on the correct recordset)
and set focus to it:
Private Sub txtProductName_GotFocus()
' When the user enters the text box that contains the product name,
' focus will be moved to the underlying combo box instead.
Me.cboProducts.SetFocus
End Sub
Hope this is enough to get you going.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"Bob A." <a...@me.com> wrote in message
news:mo0Mf.39798$H71....@newssvr13.news.prodigy.com...