Solved

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

Posted on 1998-04-02
5
252 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
  • 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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now