?
Solved

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

Posted on 1998-04-02
5
Medium Priority
?
262 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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 …
Suggested Courses

762 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