Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending Forms to Back 1

Status
Not open for further replies.

Prufrock

Instructor
Sep 4, 2002
77
AU
I have a switchboard which I want to send to the back when I click on a button on it which runs a query. I want the query which currently opens behind the switchboard to be in front and when I close the query I want the switchboard there. I don't mind whether it is send the form to back or bring the query to front but I want the query in dominant view once run.

Thanks
Prufrock
 
Prufrock,

Not sure if this will work, but in code, immediately after the query is opened or the SQL is run, couldn't you use the SelectObject command?

DoCmd.SelectObject acQuery, "queryname"

Not sure if this will work if you are talking about a true switchboard, but if you are talking about using a form with command buttons as a switchboard, this should bring your query to the front.

Good luck!!
 
Does anyone know why Medics suggestion did not work in my code shown below? Thanks for the help, JL

Private Sub Label6_Click()
DoCmd.OpenQuery "QRY-MoInvbyClient", acViewNormal, acEdit
DoCmd.SelectObject acQuery, "QRY-MoInvbyClient"
End Sub


 
Instead of playing with background / foreground you may want to play with the visible property of the form.

Forms![YourSwitchBoard].Visible = False

For the load event of the target form. Then reverse the boolean property for the unload event.

 
Okay, that worked great. But now it won't give me focus to the one form I want, which is a list box. So the list box is there, but when I click on a choice it doesn't do anything. I tried SetFocus on the listbox and that did not work either. Can you see from the code below why? Thanks for your help, JL


Private Sub Form_Close()
Forms![FRM-EOM-MoInvComp].Visible = True
Forms![FRM-EOM-AccData].Visible = True
Forms![FRM-EOM].Visible = True
End Sub

Private Sub Form_Open(Cancel As Integer)
Forms![FRM-EOM-MoInvComp].Visible = False
Forms![FRM-EOM-AccData].Visible = False
Forms![FRM-EOM].Visible = False
Forms![ARClientListBox].SetFocus
End Sub
 
Janet

When flipping from your SwitchBoard to your target form, you code for the open event is as follows, (Except I used the Me. reference)
Code:
Private Sub Form_Open(Cancel As Integer)
    Forms![FRM-EOM-MoInvComp].Visible = False
    Forms![FRM-EOM-AccData].Visible = False
    Forms![FRM-EOM].Visible = False
    Me.ARClientListBox.SetFocus
End Sub

The other forms, FRM-EOM-MoInvComp, FRM-EOM-AccData, FRM-EOM are invisible. (Have to wonder if they are all loaded at this time...)

And when you select the list box, which I assume used to work, nothing happens. Am I correct so far?

What ...
- is the name of the target form (which has the list box)
- does the list box do?

 
The statement Forms![ARClientListBox].SetFocus is setting focus to the form, and not to the listbox. You might try:

Forms![ARClientListBox]![<ListBoxName>].SetFocus

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Cajun, that did not work.

Will, I have a form "switchboard", which allows a user to open FormA, and on FormA a selection is offered to open FormB, and on FormB is a button offering to show invoices between certain dates. All three of these are shown in a cascade format on the screen. When the button on FormB is selected, the Listbox (ARClientListBox) on the form FRM-ARClientListBox is supposed to open, hide the other three forms, and allow you to select from the listbox, which will then open forms for a selected client. Once you select, another button directs you to press it so it can actually show you the search results.

I think I have answered everything. I sure appreciate all the help. JL
 
Janet

you to select from the listbox, which will then open forms for a selected client

By chance, is onw of the fomrs it is trying to open one of forms that are invisible? An invisilbe form is still open -- you just can not see it.

Richard
 
I apologize, my terminology was incorrect. "Which will then open a QUERY showing records for a selected client".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top