Solved

Findrecord message if no record found

Posted on 2011-03-01
4
575 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 119

Expert Comment

by:Rey Obrero
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 119

Accepted Solution

by:
Rey Obrero 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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now