"Other, please specify" prompt to new box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have only basic knowledge on Access and have created a list box in a form
with multiple select. However, within this list box I have "Other, specify"
and if this is clicked I want access to open another text box underneath this
field so that manual text can be added to this box

Is this possible?
 
Yes, it's possible.

Use a UNION query to specify the ListBox's RowSource, and add an extra
column, called "SortOrder". For example:
SELECT ID, Field1, Field2, 1 As SortOrder
UNION
(SELECT 0 As ID, "Other, specify..." As Field1, "" As Field2, 0 As
SortOrder)
ORDER BY SortOrder

If you want the list to be sorted by some other field, then just make sure
to sort by SortOrder first, then by whatever field you want to sort by. For
example:
SELECT ID, Field1, Field2, 1 As SortOrder
UNION
(SELECT 0 As ID, "Other, specify..." As Field1, "" As Field2, 0 As
SortOrder)
ORDER BY SortOrder, Field2, Field1 DESC

But you'll need to write code to handle the situation where the user selects
"Other, specify...".

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
 
Back
Top