Results 1 to 5 of 5
  1. #1
    Niko is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    Oct 2017
    Posts
    47

    No records found error message

    Hello everyone, How can i add code where it will pop up a message box " No records found! Check again!" when user key in a PO number which is not saved in the record.
    Thank you !
    Click image for larger version. 

Name:	search.png 
Views:	17 
Size:	8.5 KB 
ID:	30826

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    Could prevent the error by using a combobox that only offers valid PO numbers to select and set the combobox LimitToList property to Yes.

    Otherwise, use DLookup() or DCount() domain aggregate function:

    If DCount("*", "MXDPO", "[PO Number]='" & Me.txtKeywords & "'") > 0 Then
    MsgBox "No records found! Check again!"
    Else
    ...
    End If
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Niko is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    Oct 2017
    Posts
    47
    Quote Originally Posted by June7 View Post
    Could prevent the error by using a combobox that only offers valid PO numbers to select and set the combobox LimitToList property to Yes.

    Otherwise, use DLookup() or DCount() domain aggregate function:

    If DCount("*", "MXDPO", "[PO Number]='" & Me.txtKeywords & "'") > 0 Then
    MsgBox "No records found! Check again!"
    Else
    ...
    End If

    Hi, can this code work if my search input is a string? such as ABC17/123?

  4. #4
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    cross posted and solution found here

    https://www.access-programmers.co.uk...=1#post1550245

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    The example given is for a string value.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 10
    Last Post: 09-09-2016, 03:24 PM
  2. Replies: 12
    Last Post: 08-19-2016, 11:23 AM
  3. VBA File Not Found Message
    By dgutsche in forum Programming
    Replies: 2
    Last Post: 08-25-2014, 10:18 AM
  4. Replies: 2
    Last Post: 11-12-2013, 07:06 PM
  5. Error Message -- Path not found.
    By alansidman in forum Programming
    Replies: 5
    Last Post: 05-28-2013, 01:58 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