1. Create a simple little unbound form
2. Add a list box, and set its Name to lstQuery
Set its Row Source property to:
SELECT MSysObjects.Name FROM MsysObjects
WHERE ((MSysObjects.Type = 5) AND ([Name] Not Like "~*"))
ORDER BY MSysObjects.Name;
3. Add a command button with these properties:
Name cmdOk
Default Yes
On Click [Event Procedure]
4. Click the Build button (...) beside the On Click property.
Access opens the code window.
Set up the code so it looks like this:
Private Sub cmdOk_Click()
If IsNull(Me.lstQuery) Then
Beep
Else
DoCmd.OpenQuery Me.lstQuery
End If
End Sub
5. Add another command button with these properties:
Name cmdCancel
Cancel Yes
On Click [Event Procedure]
6. Add this line to the Click event procedure:
DoCmd.Close acForm, Me.Name
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
John via AccessMonster.com said:
Hi, I am using the Open Query Action in a macro and would like to
browse
for
the query name (to select the query to open) within the same DB. Any
suggestions?