Combobox

Joined
Dec 7, 2015
Messages
1
Reaction score
0
How can I assign a combobox (dorp list Wizard) in access to open different forms or queries. Appreciate your help
 
Joined
Jan 3, 2016
Messages
7
Reaction score
0
Hi,
If you create a form in Access and use this code you can have the list of all Forms which you have created and you can open each form that you select in ComboBox.
Code:
Option Compare Database

' btnOpenForm is the name of button
Private Sub btnOpenForm_Click()

' cboAllForms is the name of ComboBox
DoCmd.OpenForm cboAllForms.Value

End Sub

Private Sub Form_Load()

    SetComboBox

End Sub


Private Sub SetComboBox()
    Dim obj As AccessObject, dbs As Object
    Set dbs = Application.CurrentProject
    For Each obj In dbs.AllForms
        'Debug.Print obj.Name
        ' cboAllForms is the name of ComboBox
        cboAllForms.AddItem (obj.Name)
    Next obj
End Sub
 

Attachments

  • Pic1.png
    Pic1.png
    21.5 KB · Views: 500
  • Pic1.png
    Pic1.png
    21.5 KB · Views: 499
Top