Solved

Findrecord message if no record found

Posted on 2011-03-01
4
581 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
  • 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 500 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

770 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