Results 1 to 3 of 3
  1. #1
    PeterS is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2018
    Posts
    45

    ComboBox does not work on a Search Form

    Hi

    I have a search form with a ComboBox to search a query called CustomerName (cboCustomerName)
    I also have a "Search" button that opens the report that is linked to the query.

    I can select the CustomerName in the ComboBox but when I click on the "Search" button the report opens up blank....no data, only the fields of the report.

    I tested the form by using a Text Box and that works like a dream. Why is my ComboBox not working as this would greatly simplyfy the process and remove margin of data entry errors.

    This is my SQL statement for the query;

    SELECT tblCustomer.CustomerName, tblCustomer.ContactName, tblComsFeedback.ComDate, tblAccount.InvoiceNumber, tblComsFeedback.Feedback, tblAccount.FinishDate, tblAccount.InvoiceAmount
    FROM tblCustomer INNER JOIN (tblAccount INNER JOIN tblComsFeedback ON tblAccount.AccountID_Pk = tblComsFeedback.AccountID_Fk) ON tblCustomer.CustomerID_Pk = tblComsFeedback.CustomerID_Fk
    WHERE (((tblCustomer.CustomerName)=[Forms]![frmComsFeedbackAll]![txtCustomer]) AND ((tblAccount.FinishDate) Is Null))


    ORDER BY tblAccount.InvoiceNumber;

    This is my ComboBox Row Scource;

    SELECT [tblCustomer].[CustomerID_Pk], [tblCustomer].[CustomerName] FROM tblCustomer;

    My ComboBox is unbound, as is my Text Box. I have searched for a solution online but am unable to find one.

    Please help.

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    you are comparing chalk and cheese. Your combo is bound to the ID field, but you are trying to match on name

    modify your WHERE line

    WHERE (((tblCustomer.CustomerID_Pk)=[Forms]![frmComsFeedbackAll]![txtCustomer]) AND ((tblAccount.FinishDate) Is Null))

    I'm assuming txtCustomer is the name of your combo - if it isn't change the name in your query to the name of your combo

  3. #3
    PeterS is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2018
    Posts
    45
    Thank you very much. I acctually figured it out about 3 min after I posted

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

Similar Threads

  1. Search on a form that is filtered with a combobox
    By Tambe257 in forum Programming
    Replies: 1
    Last Post: 04-21-2017, 12:51 PM
  2. Replies: 3
    Last Post: 07-18-2015, 09:47 PM
  3. Search form with ComboBox
    By Voodeux2014 in forum Forms
    Replies: 16
    Last Post: 11-06-2014, 04:24 PM
  4. Search database with form combobox
    By cuddles in forum Forms
    Replies: 12
    Last Post: 05-22-2014, 01:13 PM
  5. my search form won't work?
    By sams in forum Forms
    Replies: 5
    Last Post: 05-06-2010, 02:08 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
  •  
Other Forums: Microsoft Office Forums