potts
Registered User.
- Local time
- Today, 08:43
- Joined
- Jul 24, 2002
- Messages
- 87
I'm in the closing stages of creating my database, and as a tidy-up I want to control the visibility of forms that open other forms.
for example
If form "A" opened form "B", when "B" opens "A" becomes invisible, and when "B" closes "A" becomes visible again.
As this happens numerous times throughout the database I want to control all this in a public function.
Having received a great deal of help, I've ended up with the following:
Public Function Invisiblefrm(frmInvisible As Form, strToOpen As String)
frmInvisible.Visible = False
DoCmd.OpenForm strToOpen
End Function
'this is then assigned to an On_Click event with the following code:
x = Invisiblefrm([Forms]![FormOpenedFrom], "form to be opened")
Everything is running like clockwork to this point. However, on closing the opened form, I now need to reverse the process.
I tried doing this using another public function assigned in a similar manner to the Invisiblefrm function:
Public Function Back(strToClose As String)
DoCmd.Close acForm, strToClose
frmInvisible.Visible = True
End Function
This is where it all goes wrong. the frmInvisible line isn't too popular.... I keep getting a message telling me that the "variable is not defined" and frmInvisible is highlighed blue.
Can anyone help as this is really dragging out now, and the workload is piling up rapidly!!!
Thanks very much.
for example
If form "A" opened form "B", when "B" opens "A" becomes invisible, and when "B" closes "A" becomes visible again.
As this happens numerous times throughout the database I want to control all this in a public function.
Having received a great deal of help, I've ended up with the following:
Public Function Invisiblefrm(frmInvisible As Form, strToOpen As String)
frmInvisible.Visible = False
DoCmd.OpenForm strToOpen
End Function
'this is then assigned to an On_Click event with the following code:
x = Invisiblefrm([Forms]![FormOpenedFrom], "form to be opened")
Everything is running like clockwork to this point. However, on closing the opened form, I now need to reverse the process.
I tried doing this using another public function assigned in a similar manner to the Invisiblefrm function:
Public Function Back(strToClose As String)
DoCmd.Close acForm, strToClose
frmInvisible.Visible = True
End Function
This is where it all goes wrong. the frmInvisible line isn't too popular.... I keep getting a message telling me that the "variable is not defined" and frmInvisible is highlighed blue.
Can anyone help as this is really dragging out now, and the workload is piling up rapidly!!!
Thanks very much.