Results 1 to 8 of 8
  1. #1
    New Lounger
    Join Date
    Mar 2002
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Textbox enabled (Access2000)

    Hi
    I have a report that when it opens I would like to be able to have labels enabled or unenabled (hidden or not) These labels have pre entered text for example "Second notice" etc. What I am trying to do is by selecting option buttons on a from and then creating a report have the items chosen on the from predetermine what labels on the report are enabled. This is the code I am trying to get working but I am having some problems, any help would be great?
    E.g
    Note: I have two option buttons (Options7(Value set to 1) & Option8(Value set to 2)) inside a frame (Frame5) on the form (frmPayment)
    CODE
    Private Sub Report_Open(Cancel As Integer)
    If Form_frmPayment!Frame5.Value = 1 Then
    Me!Label110.Enabled = True
    Else
    Me!Label110.Enabled = False
    End If
    If Form_frmPayment!Frame5.Value = 2 Then
    Me!Label111.Enabled = True
    Else
    Me!Label111.Enabled = False
    End Sub

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Textbox enabled (Access2000)

    You will have to reference the field Frame5 as follows:
    Forms!Form_frmPayment!Frame5
    I presume that Form_frmPayment is the name of your form.
    Pat

  3. #3
    New Lounger
    Join Date
    Mar 2002
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Textbox enabled (Access2000)

    Pat
    That worked but now the next line (Me!label110.Enabled = True) is not working. I tried (Reports!Report1!label110.Enabled =true ) & (Report!Report1!Label110.Enabled =true ) both did not work. Would you know if you can use this enabled statement on a report or is it possible to change the text color property of the label to transparent?

    John

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Textbox enabled (Access2000)

    Do you know if the code is going to the True condition?
    Put a msgbox or set a breakpoint on the If statement and see what is in your variables.

    You have left out an End If from your second If statement.

    Pat

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Textbox enabled (Access2000)

    A label doesn't have an Enabled property; Enabled is for text boxes, list boxes, command buttons etc. Use the Visible property to show or hide a label.

  6. #6
    New Lounger
    Join Date
    Mar 2002
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Textbox enabled (Access2000)

    Thanks Pat and Hans
    I have it working now GREAT!!

    Thanks
    John

  7. #7
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Textbox enabled (Access2000)

    Thanks Hans, I missed that one.

    BTW what would happen if the .Enable statement was executed on the label, I would presume it would drop a method not known error on you?

    Pat

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Textbox enabled (Access2000)

    Hi Pat,

    Yes, that's what happens if I try to do that. The Visual Basic Editor doesn't complain, the project can even be compiled, but trying to view the report results in run-time error 438. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •