?
Solved

Findrecord message if no record found

Posted on 2011-03-01
4
Medium Priority
?
596 Views
Last Modified: 2012-06-27
I am using the findrecord function and I need to have a message popup if the record isn't found.

The code I am using is:

DoCmd.GoToControl "ID"
DoCmd.FindRecord Me!txtRecord, , True, , True
0
Comment
Question by:gedwardnelson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35014093
is the form bound to the table or query?
what does Me!txtRecord contain? is this an input from the keyboard?
0
 

Author Comment

by:gedwardnelson
ID: 35014170
Hi Capricorn1

Yes it's a bound form. Me!txtrecord is an unbound text box where the record number is entered from the keyboard.

ID is an autonumber field of the bound form.

If the specific record number doesn't exist (it's been deleted for example, or the record number being looked for is greater than exists) a message box will appear notifying the user the record doesn't exist.

Thanks,
George
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 35014228

try this codes

with me.recordsetclone

       .findfirst "[ID]=" & me.txtrecord
        if not .nomatch then
             me.bookmark=.bookmark
             else
              msgbox "record not found"
        end if

end with
0
 

Author Closing Comment

by:gedwardnelson
ID: 35014298
Thanks again Cap. Worked perfectly!

George
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question