Results 1 to 5 of 5

Thread: [RESOLVED] combo box - please help

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2005
    Location
    NTU, Singapore
    Posts
    42

    Resolved [RESOLVED] combo box - please help

    Hi,

    I am using the following VBA code but it is giving me a Type Mismatch error on the line marked below.

    Private Sub Combo0_AfterUpdate()

    Dim sql As String
    Dim rst As Recordset

    sql = "Select * from MailboxCats where MailboxName= '" & Me.Combo0.Value & "'"


    Set rst = CurrentDb.OpenRecordset(sql) <--------- TYPE MISMATCH ERROR

    'extract the sub category field

    While Not rst.EOF
    Combo2.AddItem rst.Fields(1) 'I am extracting the second field
    rst.MoveNext
    Wend

    End Sub


    Please help. Thanks

  2. #2
    Hyperactive Member nagasrikanth's Avatar
    Join Date
    Nov 2004
    Location
    India,Hyderabad.
    Posts
    420

    Lightbulb Re: combo box - please help

    Hi...

    I thnk mail box name field is not a text field...it might be a numeric field...
    u need to remove the single quote ( ' ) in the sql statement
    VB Code:
    1. sql = "Select * from MailboxCats where MailboxName= " & Me.Combo0.Value & ""

    Try it...it definetly works...

    All the best..
    Anu..
    The Difference between a Successful person and others is not a Lack of Knowledge,
    But rather a Lack of WILL

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2005
    Location
    NTU, Singapore
    Posts
    42

    Re: combo box - please help

    Anu, unfortunately mailboxname is a text field. Removing the single quote gives a different error that no records were found in query SQL.

    Any other ideas? Thanks

  4. #4

    Thread Starter
    Member
    Join Date
    Aug 2005
    Location
    NTU, Singapore
    Posts
    42

    Re: combo box - please help

    Thanks.. I solved the problem on my own.

  5. #5
    Hyperactive Member nagasrikanth's Avatar
    Join Date
    Nov 2004
    Location
    India,Hyderabad.
    Posts
    420

    Re: [RESOLVED] combo box - please help

    Could u please tell me whats the problem is....
    The Difference between a Successful person and others is not a Lack of Knowledge,
    But rather a Lack of WILL

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