Results 1 to 9 of 9
  1. #1
    Join Date
    Aug 2003
    Posts
    160

    Unanswered: Type mismatch error in VBA code

    Hi! I am getting Type mismatch error for the form I designed.

    I am attaching the database.

    I am describing the tables, queries, and forms related to my problem.

    Tables: Order Details,ChecklistTitles,DetailChecklist

    Queries: QrySelectedTitles,QryDetailChecklistTitles,QryList titles

    Forms:frmDetailChecklist

    In the above form I want to select the title into other Listbox. But it is giving me error like type mis match.

    I am attaching the database.

    Any Help Apprecited.
    Attached Files Attached Files
    Vad

  2. #2
    Join Date
    Nov 2003
    Posts
    267
    Try changing this

    .Fields("ChecklistID") = Me.ListAvailable.ItemData(varItem)

    to this

    .Fields("ChecklistID") = Me.ListAvailable.Column(0)

    Now I don't know if this will work becuaes I don't have all the libraries you are running so I get different errors, but I beleive that this should work for you.

    S-

  3. #3
    Join Date
    Aug 2003
    Posts
    160
    It is not working even if I change the code. The similar code is working fine with the other application. I will send you the other application.

    Thanks



    Originally posted by sbaxter
    Try changing this

    .Fields("ChecklistID") = Me.ListAvailable.ItemData(varItem)

    to this

    .Fields("ChecklistID") = Me.ListAvailable.Column(0)

    Now I don't know if this will work becuaes I don't have all the libraries you are running so I get different errors, but I beleive that this should work for you.

    S-
    Attached Files Attached Files
    Vad

  4. #4
    Join Date
    Nov 2003
    Posts
    267
    The difference is in which is your bound column in the properties of the listbox it needs 1 not 2

    S-

  5. #5
    Join Date
    Aug 2003
    Posts
    160
    How it could be, actually I am bounding ChecklistID(Autonumer) in the first database I have sent. How it could bound to Title?

    In the code:

    For Each varItem In Me.ListAvailable.ItemsSelected
    With rst
    .AddNew
    .Fields("DetailID") = Me.DetailID
    .Fields("ChecklistID") = Me.ListAvailable.ItemData(varItem)/*here It is sending values from Listbox to recorset based on ChecklistID I guess/*
    .Update
    End With
    Next varItem

    I tried like that also but I am still getting the same error.

    Thanks


    Originally posted by sbaxter
    The difference is in which is your bound column in the properties of the listbox it needs 1 not 2

    S-
    Vad

  6. #6
    Join Date
    Nov 2003
    Posts
    267
    Don't know if you are still looking

    You need to dim you recordset as a DAO recordset in 2000

    Dim rst As dao.Recordset


    Also you will need to change the bound column to 1
    S-

  7. #7
    Join Date
    Aug 2003
    Posts
    160
    That Works. Thanks A lot .

    How can I insert horizontal scroll bars for a list box. Is It posiible or not. I am getting the Vertical scroll bars when the records in the list box exceeds the length of the list box. But how to get Horizonal scroll bars.

    Any Help Appreciated.

    Regards
    Vad



    Originally posted by sbaxter
    Don't know if you are still looking

    You need to dim you recordset as a DAO recordset in 2000

    Dim rst As dao.Recordset


    Also you will need to change the bound column to 1
    S-
    Last edited by vad; 12-03-03 at 16:00.
    Vad

  8. #8
    Join Date
    Nov 2003
    Posts
    267
    If you overall length of the of your column widths of the listbox is longer the the stated width of the listbox object, I beleive that the horzontal scroll bar shows automatically. At least then have for me.


    S-

  9. #9
    Join Date
    Aug 2003
    Posts
    160
    Eventhough the width of the text is more than the width of the Listbox, I am not getting the horizontal scroll bars.

    If I manually chenge the width, it is changing. I can change it manually but I don't have enough space.

    Thanks!

    Originally posted by sbaxter
    If you overall length of the of your column widths of the listbox is longer the the stated width of the listbox object, I beleive that the horzontal scroll bar shows automatically. At least then have for me.


    S-
    Vad

Posting Permissions

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