On Wed, 20 May 2009 16:18:37 -0700, fredg
Thanks for the reply Fred. My replies inline...
Are you sure you wish to let users fiddle around with a query?
Yes. It's for the boss--a senior biologist.
We have a barrel-full of analytical queries, many in series,
and I'm trying to reduce some of the confusion by making a
form that is somewhat like a map. Each query name is on a
button that will open it that query in data view for a
left-click, or design view for a right-click.
DoCmd.OpenQuery "QueryName", acDesign
works for me, displaying the query by example grid with the focus.
My code:
*****
Private Sub cmdqryY_M_S_TtlHrs_RA_MouseDown(Button As
Integer, Shift As Integer, X As Single, Y As Single)
Dim stDocName As String
stDocName = "qryY_M_S_SpHrs_RA"
If Button = acLeftButton Then
DoCmd.OpenQuery stDocName, acNormal, acEdit
End If
If Button = acRightButton Then
DoCmd.OpenQuery stDocName, acDesign
End If
End Sub
*****
It opens the query in design view, but the form retains the
focus, and a popup for it appears--the one with filtering
and sorting options, and at the bottom, "Properties". I
have to click on the query to give it the focus--not very
clean.
Perhaps you have some other code that moves the focus elsewhere.
Nope. Brand new form with no code for the form itself, just
code for a gaggle of buttons.