Results 1 to 7 of 7
  1. #1
    Tomhoneyman is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Feb 2016
    Posts
    5

    Combo Box For Searching Forms Help

    Okay, I am making a database and want to use a combo box to search a form and display date in a subform to give multiple search criteria.
    I have followed a YouTube step but cant get it to work. The code is as below, anything jump out at you?


    Private Sub cboSearchCustomer_AfterUpdate()
    Dim myCustomer As String
    myCustomer = "select from frmSearch where (Customer Name) = me.cboSearchCustomer "
    Me.frmTest2SubForm.Form.RecordSource = myCustomer
    Me.frmTest2SubForm.Form.Requery
    End Sub

    Tom

  2. #2
    Tomhoneyman is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Feb 2016
    Posts
    5
    More info, I have followed the YouTube video here:

    https://www.youtube.com/watch?v=8N1hRBdsI1s

    And the error message I am getting is:
    Runtime Error 3141

    The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect

  3. #3
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    have you tried to debugging the string? below the third line enter a new line
    Code:
    debug.print(mycustomer)
    view in the immediate window. i believe you should be selecting something in your statement like "select customer from......"

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    you don't have to run another query, just filter the records
    Code:
    Private Sub cboSearchCustomer_AfterUpdate()
            Me.filter  = "[customerName]='" & me.cboSearchCustomer & "'"
           Me.filterOn = true
     End Sub

  5. #5
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  6. #6
    Tomhoneyman is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Feb 2016
    Posts
    5
    The debug says there is an issue with

    Me.frmTest2SubForm.Form.RecordSource = myCustomer

  7. #7
    JamesDeckert is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jul 2015
    Location
    Salina, KS
    Posts
    262
    You'll need to give exact error messages.
    Here's a different youtube which I created. Maybe it'll help.
    https://www.youtube.com/watch?v=nJXqMJC60oY

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Combo boxes in forms
    By kong in forum Forms
    Replies: 5
    Last Post: 12-01-2015, 09:32 AM
  2. Replies: 14
    Last Post: 05-27-2015, 11:37 AM
  3. Replies: 17
    Last Post: 03-15-2013, 02:30 PM
  4. Web Forms Searching
    By siansoft in forum Programming
    Replies: 0
    Last Post: 09-28-2011, 11:12 AM
  5. searching Web Forms
    By jonesdwj in forum Programming
    Replies: 0
    Last Post: 07-08-2011, 03:22 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums