Once you make a selection from the List Box the Command Button caption will change to the Company Name chosen and the List Box will become invisible.
Simulate a Drop Down Box...

Create a Drop Down, like those found on Web pages, as opposed to a regular Combo Box.  The only caveat would be is you cannot have controls directly below because you will using a List Box which takes up considerably more space than a regular Combo Box.  To download the sample click here.
9.11.2011 - Fixed *94 Invalid use with NULL* error when run in Access 2007
The difficult I do immediately, the impossible takes a little bit longer.
Forms
Tips (Main)
Home
Let your Client customize the form labels
Linking Subforms to an Unbound Control(s) on the Main (Parent) Form
Customize your Main Menu or Switchboard
Auto-Add new child records when adding a new record on the Main (Parent) Form
Simple Bar Chart using Shapes
Implement a Log-On form to control what the User sees
Make Controls resize with a Form
Switch Windows
Assign *Permissions* based on Users Levels
New User Form
Add *Favorites* to a Continuous Form
Custom Record Selectors
Searching Records
Drill Down (for Continuous Forms)
Highlight Required Controls (End-User Defined)
When you initially open the Form all you see is the Command Button.  Once you click on it the List Box will appear.
Option Compare Database
Option Explicit
 
Private Sub lstListBox_AfterUpdate()
     Me.cmdSelectCompany.SetFocus
     Me.lstListBox.Visible = False
     Me.lstListBox.RowSource = "SELECT [tblClientProfile].[cpClientID], [tblClientProfile].[cpCompanyName] FROM tblClientProfile;"
     Me.cmdSelectCompany.Caption = Me.lstListBox.Column(1)
End Sub
 
Private Sub cmdSelectCompany_Click()
If Me.lstListBox.Visible = True Then
     Me.lstListBox.Visible = False
Else
     Me.lstListBox.Visible = True
     Me.lstListBox.SetFocus
End If
End Sub
 
Private Sub Form_Current()
     Me.lstListBox.Visible = False
End Sub
Don't forget to change the Control names to match you own!
Click to send feedback...
This site uses cookies to collect data on usage. By continuing to browse this site you consent to this policy. Find out more here.