A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

toggle link disabled



 
 
Thread Tools Display Modes
  #1  
Old May 8th, 2008, 11:53 PM posted to microsoft.public.access.forms
zizi2007 via AccessMonster.com
external usenet poster
 
Posts: 7
Default toggle link disabled

hello,

I have a form with 2 toggle buttons on it, to open 2 separate forms. Unless
I set the AllowEdits to Yes in the properties in the form design, these two
toggle buttons are disabled.

how can I change that? I don't want the user to be able to edit any of the
fields (I have a separate edit button, so that I can archive the record and
make a new record (for historical purposes)) .

Thanks in advance for your help.
Z
------------------------------------------------------------------------------
--------------------------------
here is the code:
Option Compare Database
'-----------------------------------------------------------------------------
---------------------------------
Sub Form_Current()
On Error GoTo Form_Current_Err

If GroupsFormIsOpen() Then FilterGroupsForm
If RatesFormIsOpen() Then FilterRatesForm

Me!cmdUndo.Enabled = False

Form_Current_Exit:
Exit Sub

Form_Current_Err:
MsgBox Error$
Resume Form_Current_Exit
End Sub
'-----------------------------------------------------------------------------
---------------------------------
Sub cmdUndo_Click()

On Error GoTo cmdUndo_Click_Err
DoCmd.RunCommand acCmdUndo

cmdUndo_Click_Exit:
Exit Sub

cmdUndo_Click_Err:
MsgBox Error$
Resume cmdUndo_Click_Exit

End Sub
'-----------------------------------------------------------------------------
---------------------------------
Private Sub Form_Dirty(Cancel As Integer)
Me!cmdUndo.Enabled = True

End Sub
'-----------------------------------------------------------------------------
---------------------------------

Sub ToggleLink_Click()
On Error GoTo ToggleLink_Click_Err

If GroupsFormIsOpen() Then
CloseGroupsForm
Else
OpenGroupsForm
FilterGroupsForm
End If

ToggleLink_Click_Exit:
Exit Sub

ToggleLink_Click_Err:
MsgBox Error$
Resume ToggleLink_Click_Exit

End Sub
'-----------------------------------------------------------------------------
---------------------------------

Private Sub FilterGroupsForm()

If Me.NewRecord Then
Forms![Groups].DataEntry = True
Forms![Groups].OrderByOn = True
Else
Forms![Groups].Filter = "[GroupID] = " & """" & Me.[Group_ID] & """"
Forms![Groups].FilterOn = True
Forms![Groups].OrderByOn = True
End If

End Sub
'-----------------------------------------------------------------------------
---------------------------------

Private Sub OpenGroupsForm()

DoCmd.OpenForm "Groups"
If Not Me.[ToggleLink] Then Me![ToggleLink] = True

End Sub
'-----------------------------------------------------------------------------
---------------------------------

Private Sub CloseGroupsForm()

DoCmd.Close acForm, "Groups"
If Me![ToggleLink] Then Me![ToggleLink] = False

End Sub
'-----------------------------------------------------------------------------
---------------------------------

Private Function GroupsFormIsOpen()

GroupsFormIsOpen = (SysCmd(acSysCmdGetObjectState, acForm, "Groups") And
acObjStateOpen) False

End Function
'-----------------------------------------------------------------------------
---------------------------------

Sub RatesToggle_Click()
On Error GoTo RatesToggle_Click_Err

If RatesFormIsOpen() Then
CloseRatesForm
Else
OpenRatesForm
FilterRatesForm
End If

RatesToggle_Click_Exit:
Exit Sub

RatesToggle_Click_Err:
MsgBox Error$
Resume RatesToggle_Click_Exit

End Sub
'-----------------------------------------------------------------------------
---------------------------------

Private Sub FilterRatesForm()

If Me.NewRecord Then
Forms![Rates].DataEntry = True
Else
Forms![Rates].Filter = "[GroupID] = " & """" & Me.[Group_ID] & """"
Forms![Rates].FilterOn = True
End If

End Sub
'-----------------------------------------------------------------------------
---------------------------------
Private Sub OpenRatesForm()

DoCmd.OpenForm "Rates"
If Not Me.[RatesToggle] Then Me![RatesToggle] = True

End Sub
'-----------------------------------------------------------------------------
---------------------------------
Private Sub CloseRatesForm()

DoCmd.Close acForm, "Rates"
If Me![RatesToggle] Then Me![RatesToggle] = False

End Sub
'-----------------------------------------------------------------------------
---------------------------------
Private Function RatesFormIsOpen()

RatesFormIsOpen = (SysCmd(acSysCmdGetObjectState, acForm, "Rates") And
acObjStateOpen) False

End Function

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200805/1

  #2  
Old May 9th, 2008, 07:07 AM posted to microsoft.public.access.forms
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default toggle link disabled

zizi,
you can change the allow edits to yes for the short time that the toggle
buttons have the focus.
Once the focus moves off the toggle buttons, set allow edits to false.
When the toggle buttons get the focus, set allow edits to true.


Jeanette Cunningham -- Melbourne Victoria Australia


"zizi2007 via AccessMonster.com" u34674@uwe wrote in message
news:83dd87dbbc0a4@uwe...
hello,

I have a form with 2 toggle buttons on it, to open 2 separate forms.
Unless
I set the AllowEdits to Yes in the properties in the form design, these
two
toggle buttons are disabled.

how can I change that? I don't want the user to be able to edit any of
the
fields (I have a separate edit button, so that I can archive the record
and
make a new record (for historical purposes)) .

Thanks in advance for your help.
Z
------------------------------------------------------------------------------
--------------------------------
here is the code:
Option Compare Database
'-----------------------------------------------------------------------------
---------------------------------
Sub Form_Current()
On Error GoTo Form_Current_Err

If GroupsFormIsOpen() Then FilterGroupsForm
If RatesFormIsOpen() Then FilterRatesForm

Me!cmdUndo.Enabled = False

Form_Current_Exit:
Exit Sub

Form_Current_Err:
MsgBox Error$
Resume Form_Current_Exit
End Sub
'-----------------------------------------------------------------------------
---------------------------------
Sub cmdUndo_Click()

On Error GoTo cmdUndo_Click_Err
DoCmd.RunCommand acCmdUndo

cmdUndo_Click_Exit:
Exit Sub

cmdUndo_Click_Err:
MsgBox Error$
Resume cmdUndo_Click_Exit

End Sub
'-----------------------------------------------------------------------------
---------------------------------
Private Sub Form_Dirty(Cancel As Integer)
Me!cmdUndo.Enabled = True

End Sub
'-----------------------------------------------------------------------------
---------------------------------

Sub ToggleLink_Click()
On Error GoTo ToggleLink_Click_Err

If GroupsFormIsOpen() Then
CloseGroupsForm
Else
OpenGroupsForm
FilterGroupsForm
End If

ToggleLink_Click_Exit:
Exit Sub

ToggleLink_Click_Err:
MsgBox Error$
Resume ToggleLink_Click_Exit

End Sub
'-----------------------------------------------------------------------------
---------------------------------

Private Sub FilterGroupsForm()

If Me.NewRecord Then
Forms![Groups].DataEntry = True
Forms![Groups].OrderByOn = True
Else
Forms![Groups].Filter = "[GroupID] = " & """" & Me.[Group_ID] &
""""
Forms![Groups].FilterOn = True
Forms![Groups].OrderByOn = True
End If

End Sub
'-----------------------------------------------------------------------------
---------------------------------

Private Sub OpenGroupsForm()

DoCmd.OpenForm "Groups"
If Not Me.[ToggleLink] Then Me![ToggleLink] = True

End Sub
'-----------------------------------------------------------------------------
---------------------------------

Private Sub CloseGroupsForm()

DoCmd.Close acForm, "Groups"
If Me![ToggleLink] Then Me![ToggleLink] = False

End Sub
'-----------------------------------------------------------------------------
---------------------------------

Private Function GroupsFormIsOpen()

GroupsFormIsOpen = (SysCmd(acSysCmdGetObjectState, acForm, "Groups")
And
acObjStateOpen) False

End Function
'-----------------------------------------------------------------------------
---------------------------------

Sub RatesToggle_Click()
On Error GoTo RatesToggle_Click_Err

If RatesFormIsOpen() Then
CloseRatesForm
Else
OpenRatesForm
FilterRatesForm
End If

RatesToggle_Click_Exit:
Exit Sub

RatesToggle_Click_Err:
MsgBox Error$
Resume RatesToggle_Click_Exit

End Sub
'-----------------------------------------------------------------------------
---------------------------------

Private Sub FilterRatesForm()

If Me.NewRecord Then
Forms![Rates].DataEntry = True
Else
Forms![Rates].Filter = "[GroupID] = " & """" & Me.[Group_ID] & """"
Forms![Rates].FilterOn = True
End If

End Sub
'-----------------------------------------------------------------------------
---------------------------------
Private Sub OpenRatesForm()

DoCmd.OpenForm "Rates"
If Not Me.[RatesToggle] Then Me![RatesToggle] = True

End Sub
'-----------------------------------------------------------------------------
---------------------------------
Private Sub CloseRatesForm()

DoCmd.Close acForm, "Rates"
If Me![RatesToggle] Then Me![RatesToggle] = False

End Sub
'-----------------------------------------------------------------------------
---------------------------------
Private Function RatesFormIsOpen()

RatesFormIsOpen = (SysCmd(acSysCmdGetObjectState, acForm, "Rates") And
acObjStateOpen) False

End Function

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200805/1



  #3  
Old May 9th, 2008, 03:21 PM posted to microsoft.public.access.forms
zizi2007 via AccessMonster.com
external usenet poster
 
Posts: 7
Default toggle link disabled

could you be more specific about where to put that?

thanks.

--
Message posted via http://www.accessmonster.com

  #4  
Old May 9th, 2008, 03:34 PM posted to microsoft.public.access.forms
zizi2007 via AccessMonster.com
external usenet poster
 
Posts: 7
Default toggle link disabled

Never mind... I figured it out!! I just got to work, so I was not thinking
clearly yet!

thanks for your help. have a good weekend down under!

Zizi2007

--
Message posted via http://www.accessmonster.com

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:41 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.