Page 2 of 2 FirstFirst 12
Results 16 to 30 of 30
  1. #16
    Lesg is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    101
    Quote Originally Posted by Ajax View Post
    provide the actual code you are using together with any error messages as I cannot see anything wrong with the code I provided once the extra ) is taken out - the previous error message you provided was quite clear as to what and where the problem was
    This is the code currently with the extra closing bracket removed:

    cboProducts.RowSource = "SELECT DISTINCTROW tblPrices.productID, products.Item, tblPrices.price, tblinventory.Sumofqty, tblPrices.CustID, tblPrices.available" & _
    " FROM ((products INNER JOIN tblPrices ON products.productID = tblPrices.productID) INNER JOIN tblUnits ON products.unitsID = tblUnits.unitsID) LEFT JOIN tblinventory ON tblPrices.productID = tblinventory.productID" & _
    " WHERE products.Item Like '*' & [cboProducts].text & '*' AND tblPrices.CustID=" & Me.[txtcustID] & " AND tblPrices.available=False" & _
    " ORDER BY products.Item"

    And this is the error I get:
    Click image for larger version. 

Name:	search error03.JPG 
Views:	29 
Size:	23.7 KB 
ID:	47059

  2. #17
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    that is saying that you have a null value for txtCustID - look at the error message - you have

    ....tblPrices.CustID=" & me.[txtCustID] & " AND....

    and in the error message

    ...tblPrices.CustID= AND....

  3. #18
    Lesg is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    101
    Quote Originally Posted by Ajax View Post
    that is saying that you have a null value for txtCustID - look at the error message - you have

    ....tblPrices.CustID=" & me.[txtCustID] & " AND....

    and in the error message

    ...tblPrices.CustID= AND....
    Ah ok, let me look into that, will update

  4. #19
    Lesg is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    101
    Quote Originally Posted by Ajax View Post
    perhaps try in the cboProducts change event

    Code:
    cboProducts.rowsource="SELECT DISTINCTROW tblPrices.productID, products.Item, tblPrices.price, tblinventory.Sumofqty, tblPrices.CustID, tblPrices.available" & _
                          " FROM ((products INNER JOIN tblPrices ON products.productID = tblPrices.productID) INNER JOIN tblUnits ON products.unitsID = tblUnits.unitsID) LEFT JOIN tblinventory ON tblPrices.productID = tblinventory.productID" & _
                          " WHERE products.Item Like '*' & [cboProducts].text & '*' AND tblPrices.CustID)=" & me.[txtCustID] & " AND tblPrices.available=False" & _
                          " ORDER BY products.Item"
    
    Edit: you may need to cater for when a user types something then backspaces to clear the entry so there is a zls or null value, note also the change for "*" to '*'
    Edit2: perhaps make it conditional on users typing more than three characters or trigger a timer event on each keypress and if no further timing after say 1/2 second (timer interval=500) the timer event populates the combo rowsource
    Hi Ajax, sorry for delay in coming back, had a few other things to resolve. So I have corrected that issue now, the error was the format for the txtCustID I was adding, but have fixed this now.

    The issue now I have is that when I type a name into the combo, I have a few issue, nothing is populated in the drop down as I type (maybe not an issue is the user clicks enter it does show values in the dropdown), however, on clicking enter, I get a message box box stating that the value entered is not in the list:Click image for larger version. 

Name:	comboNoInList.JPG 
Views:	21 
Size:	66.4 KB 
ID:	47122

    I am thinking I could add something to not show the message box, currently I have now value in the notinlist event:Click image for larger version. 

Name:	notinlist.JPG 
Views:	22 
Size:	37.2 KB 
ID:	47123

    But then for the next line item, the combo does not filter the values by the entered text, so I think that is what you are referring to in the timer event, to repeater the method for the first row?

    I can see the timer function, but not sure what I would add?

    many thanks for the advise.

  5. #20
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    according to the code you have posted you have not used the change event, you have used the dirty event. Fix that first

  6. #21
    Lesg is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    101
    I have changed that now to onChange, I had been testing with other settings trying to resolve

  7. #22
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    your message appears to be a custom one - so you need to find out what triggers it - it may be settings - field is required, or combo limit to list immediately come to mind, or perhaps some code in the control or form before update event or another control

  8. #23
    Lesg is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    101
    For the combo box, the events are just the AfterUpdate and OnChange

    Code:
    Private Sub cboProducts_AfterUpdate()Dim strFilter As String
    
    
    
    
    DoCmd.OpenQuery "TempCustomerPriceCheck2"
    
    
        strFilter = "ProductID=" & Me!cboProducts
                Me!price = DLookup("price", "Temppricecheck", strFilter)
                Me!units = DLookup("unitsID", "temppricecheck", strFilter)
        Me.CustID = Forms!frmOrderPlacement!txtcustID
    
    
       Me.txtqty.SetFocus
            
    End Sub
    
    
    
    
    Private Sub cboProducts_Change()
    cboProducts.RowSource = "SELECT DISTINCTROW tblPrices.productID, products.Item, tblPrices.price, tblinventory.Sumofqty, tblPrices.CustID, tblPrices.available" & _
                          " FROM ((products INNER JOIN tblPrices ON products.productID = tblPrices.productID) INNER JOIN tblUnits ON products.unitsID = tblUnits.unitsID) LEFT JOIN tblinventory ON tblPrices.productID = tblinventory.productID" & _
                          " WHERE products.Item Like '*' & [cboProducts].text & '*' AND tblPrices.CustID=Forms!frmOrderPlacement!txtcustID AND tblPrices.available=False" & _
                          " ORDER BY products.Item"
    End Sub
    This allows standard products to use 'custom' pricing for the current customer.

    I have tried in the
    Code:
    Private Sub cboProducts_NotInList(NewData As String, Response As Integer)DoCmd.SetWarnings False
    End Sub
    but this does not work and the alert still pops up, the filtering works fine for the next product, I just need to stop this message box appearing now?

  9. #24
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    and your settings?

  10. #25
    Lesg is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    101
    can you clarify where you mean in terms of settings please?

  11. #26
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    where you mean in terms of settings please?
    the combo properties
    Click image for larger version. 

Name:	image_2022-01-26_143930.png 
Views:	14 
Size:	9.1 KB 
ID:	47164

  12. #27
    Lesg is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    101
    thanks for that feedback. very strange thing going on, as I have a version of the frontend that that the combo works perfectly as required, not not in list message, and each row allows for a new search entry.

    But I have another backup version, that was just a copy of that form, and it shows the pop up not in list message. I am going to check and compare both, but looks like its working now. so thanks so much for your help on this

  13. #28
    Lesg is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    101
    Hey Ajax,

    Sorry to open this again, but today, for some reason, and I have no idea why, I am getting the pop alert message again now. I have checked those settings as suggested and all set as recommended, but today this popup has started again!

    Can you suggest something for the 'is not in list' event handler that would stop it?

  14. #29
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    sorry no. Suggest you upload a copy of your db - remove tables/forms etc not relevant to your question, compact then zip before uploading. Populate with dummy data if you need to

  15. #30
    Lesg is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    101
    so have added the following and seems to work, just need to test now:

    Private Sub cboProducts_NotInList(NewData As String, Response As Integer)
    Response = acDataErrContinue
    Me.cboProducts.Dropdown
    End Sub

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Search as you type in Combo Box
    By Grandad in forum Access
    Replies: 29
    Last Post: 07-11-2020, 12:31 PM
  2. Search combo box as I type inside it
    By bilalo in forum Forms
    Replies: 8
    Last Post: 07-14-2019, 09:03 PM
  3. Replies: 4
    Last Post: 01-31-2018, 10:37 AM
  4. Search as you type - Combo box
    By lateral in forum Programming
    Replies: 20
    Last Post: 01-29-2015, 12:16 AM
  5. search as you type in combo box
    By pratim09 in forum Forms
    Replies: 3
    Last Post: 08-05-2011, 07:46 AM

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