Looks like you are out of luck unless you do it another way. I just created a form without a record source and then placed a sub form on this form for the records I wanted to see. The main form can be opened in dialog mode however the subform will have the scroll bars you are looking for.
DaveSH, the neat thing about Dialog mode is that your code is suspended until the form closes. This will allow the user to make a selection or some other decision that will allow the code to continue conditionally. Neat stuff when you need user interaction as code is executing.
John A. Gilman
gms@uslink.net
I have a form called frmName where the user enters his name/password.
That takes him to a form called frmSwitchboard. (where he can navigate through the database)
Between the two forms, my boss wanted me to make a pop up annoying form to remind the users of any late, or soon to be late projects. So I created a form called frmLateProjects.
So now on the FormLoad event of frmSwitchboard, I have DoCmd.OpenForm “frmLateProjects”,,,,acDialog.
On the OnOpen event of frmLateProjects I have the following code to close the form if there is no data:
On Error Resume Next
'if there are no late projects, display a message and close the form
If Me.ID_No.Value = "" Then
MsgBox "You have no late projects!", , "No Late Projects"
DoCmd.Close
End If
If Err.number = 2427 Then
DoCmd.Close acForm, "frmLateProjects"
End If
If I don’t open the frmLateProjects as Dialog, then frmName is the focus after the user closes frmLateProjects, not frmSwitchboard.
FrmLateProjects opened not as Dialog:
The user enters his name and password, then he sees frmLateProjects appear with its scroll bars. (good).
He closes frmLateProjects and sees frmName again (not good, I want him to see frmSwitchboard). frmSwitchboard is opened, it’s just not the focus.
FrmLateProjects opened as Dialog:
The user enters his name and password, then he sees frmLateProjects appear with no scroll bars. (not good).
He closes frmLateProjects and sees frmSwitchboard (good).
I need frmName to stay open, but I don’t want it to get the focus after the user closes frmLateProjects.
Overall, is there a more efficient way to do this pop up form thing? It seems a bit slow in general.
that's a good suggestion, but it won't work because other forms also open the frmLateProjects.
i have a few frmSwitchboard forms:
one called frmSwitchboardEmployees, one called frmSwitchboardManagers, one called frmSwitchboardProjectManagers, etc.
so if i put the code in the OnClose event, i am sure to get an error eventually "...Access cannot find the form..."
use the openArgs part of the DoCmd.OpenForm "FrmLateProjects",,,,,,"Form To Return To"
that way you can tell the form what to do when it is closed.
in your onclose event check the information you placed into the OpenArgs and take the required action. I use it this way sometimes. I put the name of the form I want to set the focus to in the OpenArgs property. Then on the close event it looks like this
Dim ReturnTo as String
ReturnTo = Me.OpenArgs
Forms(ReturnTo).SetFocus
John A. Gilman
gms@uslink.net
hmmm. it's not working. i did everything you said. I put the "frmSwitchboardEmployees" at the end of the docmd.openform command as the open args.
then i copied and pasted your ReturnTo code above for the OnClose event of the frmLateProjects.
but, it still keeps the focus of frmName after closing frmLateProjects.
If you are having to recall the users name and password in another spot in your application, what you could do is set two globals for them in a module:
global gUserName
global gPassword
That way when they login, you can capture this information, without having to keep that form running in the background.
just make sure you clear the globals when you exit the application...
If you are having to recall the users name and password in another spot in your application, what you could do is set two globals for them in a module:
global gUserName
global gPassword
That way when they login, you can capture this information, without having to keep that form running in the background.
just make sure you clear the globals when you exit the application...
ruthcali, have you used the break mode for watching code execution?
This will allow you to see just what is happening as your code executes. John A. Gilman
gms@uslink.net
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.