Combo Box Problems

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

Guest

Hi,

I'm looking for a little advice. I'm creating database where users can log
equipment faults in our IT suites. The usrs will access the database via a
web access page. On the page i've created a combo box which holds a list of
room numbers. below that in i have a list of computer names. I would like to
have the list of computers relavant to the room number. So if a user wants to
log a fault in "IT1" they can select it in the combo box and the computer
list will only show the computers in that room.

Phew! Can anyone give any pointers how i can achieve this.

Thank You in Advance

Dave
 
Dave,

This is done by changing the 2nd combo box' RowSource property in the
AfterUpdate event of the first. Search for forum for "Cascading Combo
Boxes". Here is another helpful link:

http://www.fontstuff.com/access/acctut10.htm

Note: If you're trying to do this on a continuous form, it's more
complicated because a combo box can have only one value for its RowSource
property, which is the same for all records. If entered records have a value
that no longer is in the RowSource list, Access cannot display the value.
The data "disappears"! even though the value in the underlying table remains
unchanged.

The workaround is to use a textbox for the 2nd value, and popup a dialog
form with a single combo box in its OnGotFocus event. After the selection is
made, you can write the selected *value* to a hidden textbox bound to the
corresponding field, and display more meaningful text if necessary by either
writing it to a visible textbox or using DLookup().

' OnGotFocus event of textbox on main form

' Open dialog box with single combo box
DoCmd.OpenForm _
FormName:="YourPopUpForm", _
View:=acNormal, _
WindowMode:=acDialog

' Set focus to the next control
Me![NextControlOnMainForm].SetFocus


' AfterUpdate event of popup form
Forms![Your1stForm]![YourBoundHiddenTbox] = Me![YourPopupCBox]
Forms![Your1stForm]![YourUnboundVisibleTbox] = Me![YourPopupCbox].Column(1)
DoCmd.Close

Hope that helps.
Sprinks
 
That's done it.

Thank You Very Much

I'll have to change my username now.
 

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

Back
Top