none
Enabled method not showing not available RRS feed

  • Question

  • Good Day folks,

    I have a checkbox (Travel Required) on a form. If the checkbox is checked, I want two disabled date fields to be enabled. My problem is that while doing my VBA code, the enabled method does not appear for my date fields.  

    For example

    IF Me. checkbox = True Then

    Me.Datefield.enabled = True. 

    So what happens is that "Value"  appears and not  enabled. I have tomanually type it, which i think should not be the case....have    I am pretty sure the answer is answer is quite simple i just can't figure it out.  I getring the error message: Method or Dae member not found


    olu Solaru

    Thursday, April 11, 2019 6:23 PM

Answers

  • Open the form in design view.

    Select the text box bound to the date field.

    Activate the Other tab of the Property Sheet.

    Look at the Name property. If the name is different from the field name, change Datefield in the line

    Me.Datefield.Enabled = True

    to the name you saw.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by osolaru71 Thursday, April 11, 2019 7:52 PM
    Thursday, April 11, 2019 6:26 PM
  • Never Mind. I got it to work the way I wanted.  Thanks for your help.

    olu Solaru

    • Marked as answer by osolaru71 Thursday, April 11, 2019 7:52 PM
    Thursday, April 11, 2019 7:51 PM

All replies

  • Open the form in design view.

    Select the text box bound to the date field.

    Activate the Other tab of the Property Sheet.

    Look at the Name property. If the name is different from the field name, change Datefield in the line

    Me.Datefield.Enabled = True

    to the name you saw.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by osolaru71 Thursday, April 11, 2019 7:52 PM
    Thursday, April 11, 2019 6:26 PM
  • Thank You Hans that seemed to fix that part but now the fields are not being enabled.   

    This is the code I put in the Form Current Event -

    Private Sub Form_Current()
        If Me.chkTravelRequired = -1 Then
          txtTravelStartDate.Enabled = True
          txtTravelEndDate.Enabled = True
        Else
          txtTravelStartDate.Enabled = False
          txtTravelEndDate.Enabled = False
        End If
        
    End Sub


    olu Solaru

    Thursday, April 11, 2019 7:16 PM
  • I think you're missing the Me.

    Private Sub Form_Current()
        If Me.chkTravelRequired = -1 Then
          Me.txtTravelStartDate.Enabled = True
          Me.txtTravelEndDate.Enabled = True
        Else
          Me.txtTravelStartDate.Enabled = False
          Me.txtTravelEndDate.Enabled = False
        End If
        
    End Sub


    If this post answered or helped you find the answer to your question, please mark it as such for other Forum users knowledge.


    • Edited by DriveEV Thursday, April 11, 2019 7:37 PM
    Thursday, April 11, 2019 7:36 PM
  • Thanks.  Is the code sufficient enough to just be in the Current Event of the form, or should i add to another event. Maybe the after update event of the checkbox.  I want to be able to do this before any record has been saved on the form.

    olu Solaru

    Thursday, April 11, 2019 7:39 PM
  • Never Mind. I got it to work the way I wanted.  Thanks for your help.

    olu Solaru

    • Marked as answer by osolaru71 Thursday, April 11, 2019 7:52 PM
    Thursday, April 11, 2019 7:51 PM