pop behind

R

rml

I have the following code on a form. The form is modal and popup. This
allows me to maximize the form on load. My problem is that when I click that
button, it is behind the main form. How can I make it be in front without
losing the modal and popup?

Thanks.


Private Sub Command265_Click()
On Error GoTo Err_Command3_Click

'Old Code
'========================
'Dim stDocName As String
'stDocName = "Codes"
'DoCmd.OpenQuery stDocName, acNormal, acEdit

Dim strSQL As String

'Construct our SQL Statement
strSQL = "SELECT code, [Codes].Make, [Codes].Description" & _
" FROM [Codes]" & _
" WHERE code IN (" & fcnFormatList([Forms]![parts]![Model]) &
");"

'Execute the SQL through the Current Project connection
CurrentProject.Connection.Execute "CREATE VIEW tempView AS " & strSQL

'Open the Query
DoCmd.OpenQuery "tempView", acViewNormal, acReadOnly

'Drop the Query
CurrentProject.Connection.Execute "DROP VIEW tempView"

Exit_Command3_Click:
Exit Sub

Err_Command3_Click:
MsgBox Err.Description
Resume Exit_Command3_Click

End Sub
 
M

Maurice

Difficult if you don't want to lose the modal and popup because that's what
modal and popup do.

You might give it a try by setting the modality of the form temporarily to
non-modal en when the query is closed set it back to modal again.

Something like:

me.modal=false
docmd.restore '- removing the maximization of the form so the query can be
viewed

the form will stay in front of the query due to the popup setting.
The only thing you have to figure out is how to set the modality back to
modal again with me.modal=true.

I think you are better of creating a form in datasheet mode displaying the
records.

Create a second form
Open the second form from the first form showing the query results in
datasheetview as follows:

DoCmd.OpenForm "form2", acNormal, , , , acDialog

this will open the form in front of the first form without losing the modal
and popup features...

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top