Results 1 to 6 of 6

Thread: Bastard of a toggle button

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Posts
    16
    I'm making a 3 way toggle button, to do sorting. The code I use is:

    Dim str As String, tgl As ToggleButton
    str = "firstname_table1"
    Set tgl = tglFirstName
    Select Case tgl.Value
    Case True
    Me.OrderBy = str & " DESC"
    Me.OrderByOn = True
    Case False
    Me.OrderByOn = False
    Case Else
    Me.OrderBy = str
    Me.OrderByOn = True
    End Select

    I always get a "Run time error '424' Object Required"

    What's the problem??

  2. #2
    Member
    Join Date
    Jun 2000
    Location
    Perth Western Australia
    Posts
    41

    Cool

    You Dim'd tgl as ToggleButton ! Is ToggleButton a User Control or User defined Type?

    Then you Set tgl = ToggleFirstname !

    What is ToggleFirstName?

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I think ToggleButton is part of the MS Forms 2.0 library, but I'm not sure about the rest.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Posts
    16
    It's a MS Forms 2.0 thing yeah

  5. #5
    Member
    Join Date
    Jun 2000
    Location
    Perth Western Australia
    Posts
    41

    Cool

    OK....... if you have the Toggle button in the components bar i.e. you have selected 'Microsoft Forms 2.0 Objects Library' AND you have a Reference to 'Microsoft Access for Windows' OR 'Microsoft Access 8.0 Object Library' you will get this problem. The three libraries differ in the properties available and conflict with each other.

    If you only have a toggle button on your form and no references to the above Microsoft Libraries it will work fine.

    If you do have these references set for other reasons, you can use Dim tgl as Object and this will create the correct type of object at run time. (Late bound)

    I hope this makes sense!

    I'm assuming you have the ToggleButton TripleState set to True and your code is in the Sub tglFirstName_Change() routine. I am also presuming that you have Form Properties for OrderBy and OrderByOn. It does'nt make any difference to the answer, but it maybe helps other people reading the thread to understand it better.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Posts
    16

    Exclamation

    Ok, I got the toggle button to work...with one exception...it doesn't actually sort my data...it just eventually deletes the first field...

Posting Permissions

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



Click Here to Expand Forum to Full Width