Results 1 to 7 of 7
  1. #1
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Option Button Problem

    Would it work to do it this way, or do you get an error?

    If Me.[STORAGE - LOX] >= 0 Then
    Me.LOXOption = 1
    Else
    Me.LOXOption = 0
    End If

    And does this program have anything to do with bagels?

  2. #2
    Star Lounger
    Join Date
    Feb 2001
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Option Button Problem

    I am using an option button and would like to be able to toggle the value of the button based on the contents of another field. It works great when I input information into the other field, however, when I delete the contents of the field the option value does not change accordingly. I am using the following for the On Change click event:

    If IsNull(Me.[STORAGE - LOX]) Or IsEmpty(Me.[STORAGE - LOX]) Then
    Me.LOXOption = 0
    ElseIf Me.[STORAGE - LOX] >= 0 Then
    Me.LOXOption = 1
    End If

    Thanks for any assistance. (I am using Access97)

  3. #3
    Star Lounger
    Join Date
    Feb 2001
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Option Button Problem

    Thanks for your response but this doesn't work either. One would think this should be simple! No to bagels, LOX is for Liquid Oxygen.


    Regards!
    [img]/w3timages/icons/clever.gif[/img]

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Option Button Problem

    I am not familiar with Access forms, but this code works in a VBA form:

    Private Sub DateTo_Change()
    If Len(Me.DateTo.Value) > 0 Then
    CriteriaSelector.OptionButton3 = True
    Else
    Call ResetOptions 'enable date-dependent default button
    End If
    End Sub

    The VBA form runs this procedure for every keystroke in the textbox. Does your form work that way as well?

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Option Button Problem

    If Len(Me.[STORAGE - LOX]&"") =0 Then
    Me.LOXOption = 0
    Else
    Me.LOXOption = 1
    End If

    Put it in the AfterUpdate event of [Storage - Lox] and in the Current event of the form and it should work. Don't use OnChange, which occurs every time you type anything into your field and so uses up CPU resources unnecessarily. There are times to use OnChange, but this isn't one of them.

    I would also urge you to stop using field names like [Storage - Lox] because they are unwieldly and always require brackets and because it is a poor naming practice to include spaces and punctuation in field names. If you ever upgrade to SQL Server, you'll have to change all those field names anyway, so do yourself a favor.
    Charlotte

  6. #6
    Star Lounger
    Join Date
    Feb 2001
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Option Button Problem

    This works great thank you very much [img]/w3timages/icons/smile.gif[/img]!

    Just wanted you to know that this was on old database I inherited and would never use those naming conventions. It needs MAJOR revamping and renaming fields is only one aspect.

    Thanks again, you've been a great help!

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Option Button Problem

    You're welcome. Glad you've got it working.
    Charlotte

Posting Permissions

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