Results 1 to 6 of 6

Thread: [RESOLVED] 2 Fields in combo box.

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Posts
    4

    Resolved [RESOLVED] 2 Fields in combo box.

    Hi,

    I have a combo box acting as a filter for a form which contains data from 2 seperate fields using the following SQL code:

    SELECT tblData.Field1 FROM tblData GROUP BY tblData.Field1 UNION SELECT tblData.Field2 FROM tblData GROUP BY tblData.Field2;

    This combo box works fine in showing the data from both fields and when I select data from Field1 it gives me the correct results in my form. However when I select data from Field2 i get no results.

    I currently have the following VB code and was wondering how I would implement Field 2 into it:

    If Not IsNull(Me.cboFilter1) Then
    strWhere = strWhere & "([Field1] = """ & Me.cboFilter1 & """) AND "
    End If

    Many thanks.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: 2 Fields in combo box.

    Is this VB6 or VBA?

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Posts
    4

    Re: 2 Fields in combo box.

    Its VB 6.3 im using it in MS Access.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: 2 Fields in combo box.

    That isn't Visual Basic.

    That is Access VBA (Visual Basic for Applications).

    Now I know why your question confused me. Visual Basic doesn't have ListBoxes or Combo boxes that support multiple columns (at least not easily or prettily).

    Moved to Office Development.

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Posts
    4

    Re: 2 Fields in combo box.

    oops! Thanks for that.

  6. #6

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Posts
    4

    Re: 2 Fields in combo box.

    RESOLVED - Worked this one out. This thread can be deleted.
    Last edited by FunkyFlea; Mar 27th, 2007 at 12:49 PM.

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