Solved

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

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

930 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