Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 1998-04-02
5
Medium Priority
?
264 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.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

597 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