Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2008

Tip: Looking for answers? Try searching our database.

toggle link disabled

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
zizi2007 - 08 May 2008 23:53 GMT
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
Jeanette Cunningham - 09 May 2008 07:07 GMT
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

> hello,
>
[quoted text clipped - 177 lines]
>
> End Function
zizi2007 - 09 May 2008 15:21 GMT
could you be more specific about where to put that?

thanks.
zizi2007 - 09 May 2008 15:34 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.