Answered Access 2010 form Questions

  • martes, 01 de mayo de 2012 16:12
     
     
     I am trying to do a few things for a custom database I am attempting to build. The first thing I am attempting is simple but I cannot nail the down the trick.  I have a check box that I want to use to make a text box appear/disappear or Enabled/disabled.  I am trying the following code I found online for the check box as on the click event

    If [Repair Description].Visible = False Then
    [Repair Description].Visible = True
    Else
    [Repair Description].Visible = False
    End If

    This is not working.

    The second trick I am attempting to solve is how to make a sub form display numerous records and update them all at the same time.  The reason is this is a maintenance DB and we have a ton of stuff that gets down weekly monthly etc...  I have built a query and the table to check when maintenance is due and then when you update the record it resets the date.  If we have to update 20-30 items it would be a pain to access each record and click the update command.

    Any help is welcome.

    Thanks in advance.

    • Editado ttmays martes, 01 de mayo de 2012 16:13
    •  

Todas las respuestas

  • martes, 01 de mayo de 2012 17:01
     
      Tiene código

    Try

    Private Check0_Click()
        Me.[Repair Description].Visible = Me.Check0
    End Sub

    where Check0 is the name of the check box. (I assume it is a "stand-alone" check box; if it's in an option group (frame), it won't have a click event.)

    About your other question: an update query can update multiple records in one go.


    Regards, Hans Vogelaar

  • martes, 01 de mayo de 2012 17:09
     
     

    Hans,

    First thanks for the reply.  The code did not work though as when I tried it it errored out with a invalid outside procedure. As for the second idea I will look to build a update query.  Thanks

  • martes, 01 de mayo de 2012 19:48
     
      Tiene código

    Sorry, my mistake - I forgot the word Sub. It should have been

    Private Sub Check0_Click()
        Me.[Repair Description].Visible = Me.Check0
    End Sub
    where, again, Check0 is the name of the check box.

    Regards, Hans Vogelaar

  • miércoles, 02 de mayo de 2012 11:39
     
     

    Hans,

    Put the new code in and I am not getting the error, however the box does not become visable when I click the yes/no box. Maybe I have some properties off on the text box.  I will check into that.

    Thanks

  • miércoles, 02 de mayo de 2012 12:02
     
     Respondida

    Make sure that the event procedure is linked to the control:

    Open the form in design view.

    Select the check box.

    Activate the Event tab of the Property Sheet.

    Select [Event Procedure] from the dropdown in the On Click event.

    Click the builder dots ... to the right of the dropdown arrow.

    This should take you to the event procedure.


    Regards, Hans Vogelaar

    • Marcado como respuesta ttmays miércoles, 02 de mayo de 2012 14:21
    •  
  • miércoles, 02 de mayo de 2012 14:23
     
     

    Hans,

    Thanks so much.  It helps when you put the code in teh right place.  I was putting in the check box not the text box that needs to be visable.  It dawned on me that I needed to move it to the right place.