Listbox showing forms

josros60

Registered User.
Local time
Today, 12:03
Joined
Mar 10, 2011
Messages
73
Hi,

is there a way to create a button that when i click it will show me the forms available and and select the one I want to open by clicking from the list.

How can i do it?

Thanks.
 
create a query, and name it qryFormNames:

SELECT [name] from msysobjects where type=-32768

now on your form drag a listbox.
set it rowsource to: SELECT [qryFormNames].[name] FROM [qryFormNames] ORDER BY [name];

use the double-click event of your listbox:

Private Sub ListboxName_DblClick(Cancel As Integer)

DoCmd.OpenForm ListboxName.value, acNormal
End Sub


'---------

another approached is to set the Rowsource Type of your listbox to Value List.
and on the OnOpen event of your form:

Private Sub Form_Open(Cancel As Integer)

Dim obj As AccessObject
For Each obj In CurrentProject.AllForms
Me.ListboxName.AddItem obj.Name
Next
Me.List0 = Me.ListboxName.ItemData(0)
End Sub
 
Last edited:

Users who are viewing this thread

Back
Top Bottom