UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Access Barcode, Access 2016    
 
   
osmith96
post Jul 22 2019, 09:56 AM
Post#1



Posts: 6
Joined: 25-June 19



Hey Guys,

I currently have a form that has a textbox(search bar) and a listbox(displays the contents from the search). On my reports for my products I have a barcode on them and I just read the barcode in with my barcode reader to quickly find a product to update some data. Everything works flawlessly. I am just having trouble getting a message to pop up if no records from the scan are not found.

The textbox is named SearchFor
The listbox is named SearchResults

CODE
Private Sub SearchFor_Change()
        On Error GoTo Err_txtProperty_Change
        
        Dim strSource As String
        strSource = "SELECT ID, ProductName " & _
         "FROM tblProductTracking " & _
         "Where ID Like '*" & Me.SearchFor.Text & "*' " _
         & "Or ProductName Like '*" & Me.SearchFor.Text & "*' " & _
         "Order by ID ASC"

        
        Me.SearchResults.RowSource = strSource

Exit_txtProperty_Change:
    Exit Sub
Err_txtProperty_Change:
    MsgBox Err.Number & " " & Err.Description
    Resume Exit_txtProperty_Change
    
End Sub





Go to the top of the page
 
theDBguy
post Jul 22 2019, 10:06 AM
Post#2


Access Wiki and Forums Moderator
Posts: 76,021
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Welcome to UtterAccess!
welcome2UA.gif

Try adding something like:
CODE
If Me.SearchResults.ListCount=0 Then
    MsgBox "Sorry, no result found.", vbInformation, "No Match"
End If
Hope it helps...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
osmith96
post Jul 22 2019, 10:42 AM
Post#3



Posts: 6
Joined: 25-June 19



Yes that worked thank you very much!
Go to the top of the page
 
theDBguy
post Jul 22 2019, 10:51 AM
Post#4


Access Wiki and Forums Moderator
Posts: 76,021
Joined: 19-June 07
From: SunnySandyEggo


Hi. You're welcome. Good luck with your project.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    19th August 2019 - 03:30 PM