Results 1 to 4 of 4
  1. #1
    alirezamb is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Feb 2015
    Posts
    2

    Check Box VBA code in a form

    Hi friends,
    I am trying to create form.
    I have a check box in my form with the name ChkDone.
    I am going to write code for this check box and link it with some fields in my form.
    The plan is if the check box is true or yes those fields will be available to insert data and if not they will be disabled.
    Please help me for this issue.


    your kind will be appritiated

  2. #2
    darshit_goswami is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2015
    Posts
    29
    here it goes...

    say u have a checkbox named as chkVehicle and you want a field depend on whether to enable or disable it based on checkbox value.
    Code:
    Private Sub chkVehicle_Click()
    If Me.chkVehicle.Value = True Then
    
    Me.VehicleNo.Enabled = True
    
    Else
        Me.VehicleNo.Value = ""
        Me.VehicleNo.Enabled = False
    End If
    
    
    End Sub
    hope this helps

  3. #3
    alirezamb is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Feb 2015
    Posts
    2
    Thank so much for your help
    but it didn't work.
    I think because of that my form type is as list.
    could you please let me know if it works with list form or not

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    ....but it didn't work.
    What didn't work? Be specific.

    Did you change "VehicleNo" to the name of one of your controls?


    I think because of that my form type is as list.
    Do you mean the form is in continuous forms view? Or you have a list box on the form?
    If the form is in continuous forms view, locking/disabling a control disables that control for all records.


    You could post your dB for evaluation......

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 06-26-2014, 12:52 PM
  2. Replies: 18
    Last Post: 06-20-2014, 12:13 PM
  3. Replies: 4
    Last Post: 03-10-2014, 12:18 PM
  4. Replies: 17
    Last Post: 11-05-2013, 04:19 AM
  5. Replies: 2
    Last Post: 02-26-2010, 08:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums