I have a command button which runs a query based on the selection from a combo box. The query runs fine, but it appears in the background with the form still blocking the view of the query. I want the button to tell the database to run the query, then minimise the form. I've tried it using VBA and macros but for some reason the query runs but the form still doesn't minimise.
This is the code I have at the moment:
If I create a separate button to minimise the form it works fine, but can't get it to work within the same button as the one that runs the query.
Any ideas if this is possible and how I can achieve it?
Thanks.
This is the code I have at the moment:
Code:
Private Sub cmdRunFamilyQuery_Click()
On Error GoTo cmdRunFamilyQuery_Click_Err
DoCmd.OpenQuery cboFamilyQueries, acViewNormal, acReadOnly
DoCmd.Minimize
cmdRunFamilyQuery_Click_Exit:
Exit Sub
cmdRunFamilyQuery_Click_Err:
MsgBox Error$
Resume cmdRunFamilyQuery_Click_Exit
End Sub
If I create a separate button to minimise the form it works fine, but can't get it to work within the same button as the one that runs the query.
Any ideas if this is possible and how I can achieve it?
Thanks.