Solved

How can I put an "Allow Edit Toggle" in a form?

Posted on 1998-04-02
5
260 Views
Last Modified: 2012-06-27
I'd like to know how to include an edit Toggle in a form, but it doesn't seem to work properly, the code I've written is:

Private Sub AllowEditionToggle_Click()
If AllowEdits = False Then
  AllowEdits = True
Else
  AllowEdits = False
End If
End Sub
0
Comment
Question by:josechu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
guillems earned 50 total points
ID: 1972993
Hi Josechu!

 The right code is:

Private Sub AllowEditionToggle_Click()
  If me.AllowEditionToggle  Then
    me.AllowEdits = True
  Else
    me.AllowEdits = False  
  End If
End Sub

But there's a big problem, once you has disable edits, the toggle button doesn't pick, So you don't change the value of allowEdits. So Try to disable all the controls in the form (ALERTA. Toggle button not) the code is:

sub disable()
  dim i as integer
  for i=0 to me.controls(0).count-1
    if (me.controls(0).name<>"TOGGLE BUTTON") then
      me.controls(0).enabled = False
      me.controls(0).locked = True
   end if
  next i
end sub

I hope this help you
0
 

Author Comment

by:josechu
ID: 1972994
I've tried it but me.controls(i).enabled doesn't work at all...

How could I make AllowEdits = False but keeping the AllowEditToggle ACTIVE?
0
 
LVL 3

Expert Comment

by:guillems
ID: 1972995
Hola!

  El problema que pasa es que no se puede desabilitar el formulario, y tener un control (en este caso el boton de activar o desactivar) activado. Creo que es un poco incongruente.

  La idea que te propongo no es más que desabilitar todos aquellos controles excepto el botón de activar o desactivar.

  Si tienes algún problema dimelo

Hasta luego! Ah y gracias por los puntos
0
 

Author Comment

by:josechu
ID: 1972996
Hola Guillermo:

He encontrado una solucion más simple con el AllowEdits...
garcias por tu ayuda :-)

Private Sub AllowEditButton_GotFocus()
EstadoEdicion = Me.AllowEdits
Me.AllowEdits = True
End Sub

Private Sub AllowEditButton_LostFocus()
Me.AllowEdits = EstadoEdicion
End Sub

0
 
LVL 3

Expert Comment

by:guillems
ID: 1972997
Ostia!
  Pues en eso no habia pensado.  Creo que a mi me servirá para un par de cosas.  

Hasta otra!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question