Toggle Help

B

Bob

--


When my Main Menu opens it opens another Form MiniMain
Private Sub Form_Open(Cancel As Integer)
DoCmd.OpenForm "frmMiniMain"
End Sub

But I have a toggle switch on my Main Menu that I want to control whether it
opens or not,this is the toggle settings, I need the script to make it work
Table: tblSetStableControlsSettings,
Field Name: MiniMain.
...............Any help thanks........Bob




....
 
B

Bob

Wayne-I-M said:
Hi Bob

I am bit confused by this.

I think ??? that you have a form (main form) and you also have another
form
(frmMiniMain) that open when you open the main form.

You want to place a button on the main form that will let you open the
frmMiniMain form

If I am correct about this

Create a button (or toggle) and place this behand the ON Click event of
this
new button or toggle


Private Sub ToggleOrButtonName_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmMiniMain"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_ToggleOrButtonName_Click:
Exit Sub
End Sub

Change "ToggleOrButtonName" to what it is on your Main form.

Don't forget to remove the OnOpen event that opens the frmMiniMain from
the
main form

Hope this helps

--
Buon Natale, Happy Chritmas.

Wayne
Manchester, England.
Scusate,ma il mio Inglese fa schiffo :)
Percio se non ci siamo capiti, mi mandate un
messagio e provero di spiegarmi meglio.
Wayne, when I open my Db the first form to open (Switchboard) is called
frmMainMenu, which activates a (Pop up Menu) frmMiniMain, I just want to
have the option as to whether frmMiniMain opens each time when I Open my Db
Thanks for any help on this............Regards Bob
 
J

JK

Bob,

Use the Open event of your Main Form:

Private Sub FORM_Open()

Dim strPopup as string
strPopup="frmMiniMain"

'Assuming Field "MiniMain is a Yes/No type
If Dlookup("[miniMain]","tblSetStableControlsSetting", _
"[SomeOtherFiled]=" & ?????) Then
DoCmd.OpenForm strPopup
End If

End Sub

If the field "MiniMain" is not a yes/no filed change the If statement to:

If Dlookup("[MiniMain]", ...etc.)="Something" then

Bear in mind that it is *not* a good idea to DLookup() on opening of a from
as that slows the opening dramatically.


Regards
Jacob
 
B

Bob

Hi Jacob, Got this working, does it look ok to you.........Regards Bob
Private Sub Form_Open(Cancel As Integer)
If UCase(DLookup("MiniMain", "tblSetStableControlsSettings")) = "-1"
Then
DoCmd.OpenForm "frmMiniMain"
End If
End Sub
JK said:
Bob,

Use the Open event of your Main Form:

Private Sub FORM_Open()

Dim strPopup as string
strPopup="frmMiniMain"

'Assuming Field "MiniMain is a Yes/No type
If Dlookup("[miniMain]","tblSetStableControlsSetting", _
"[SomeOtherFiled]=" & ?????) Then
DoCmd.OpenForm strPopup
End If

End Sub

If the field "MiniMain" is not a yes/no filed change the If statement to:

If Dlookup("[MiniMain]", ...etc.)="Something" then

Bear in mind that it is *not* a good idea to DLookup() on opening of a
from as that slows the opening dramatically.


Regards
Jacob

Bob said:
--


When my Main Menu opens it opens another Form MiniMain
Private Sub Form_Open(Cancel As Integer)
DoCmd.OpenForm "frmMiniMain"
End Sub

But I have a toggle switch on my Main Menu that I want to control whether
it opens or not,this is the toggle settings, I need the script to make it
work
Table: tblSetStableControlsSettings,
Field Name: MiniMain.
..............Any help thanks........Bob




...
 
J

JK

Hi Bob,

Looks fine but get rid of the UCase(), it does nothing.

Bear in mind if the table has more then one record, your Dlookup() function
as it is will look always at the *first* record in the table

Regards
Jacob

Bob said:
Hi Jacob, Got this working, does it look ok to you.........Regards Bob
Private Sub Form_Open(Cancel As Integer)
If UCase(DLookup("MiniMain", "tblSetStableControlsSettings")) = "-1"
Then
DoCmd.OpenForm "frmMiniMain"
End If
End Sub
JK said:
Bob,

Use the Open event of your Main Form:

Private Sub FORM_Open()

Dim strPopup as string
strPopup="frmMiniMain"

'Assuming Field "MiniMain is a Yes/No type
If Dlookup("[miniMain]","tblSetStableControlsSetting", _
"[SomeOtherFiled]=" & ?????) Then
DoCmd.OpenForm strPopup
End If

End Sub

If the field "MiniMain" is not a yes/no filed change the If statement to:

If Dlookup("[MiniMain]", ...etc.)="Something" then

Bear in mind that it is *not* a good idea to DLookup() on opening of a
from as that slows the opening dramatically.


Regards
Jacob

Bob said:
--


When my Main Menu opens it opens another Form MiniMain
Private Sub Form_Open(Cancel As Integer)
DoCmd.OpenForm "frmMiniMain"
End Sub

But I have a toggle switch on my Main Menu that I want to control
whether it opens or not,this is the toggle settings, I need the script
to make it work
Table: tblSetStableControlsSettings,
Field Name: MiniMain.
..............Any help thanks........Bob




...
 

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