Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 12th, 2004, 06:24 PM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 137
Thanks: 0
Thanked 0 Times in 0 Posts
Default End Of Records database problem


I have created a form to view records in an access 2000 database. I have removed Access record controls and have created buttons for record navigation. My problem is, if the user comes to the end of the records in a database Access pop ups a message stating this. Is there any way I can test for end of records myself and produce my own pop up? and if so how?

Gaz
__________________
Gaz
 
Old March 12th, 2004, 07:27 PM
Authorized User
 
Join Date: Feb 2004
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Your best bet is to disable the controls rather than report an error. You should disable the move first and move previous buttons if on the first record and the last and next buttons on the last record. Diabling the New record button when on a new record also makes sense.

The basic approach is to create a recordset variable and set it equal to the current form recordsetclone. Move the recordset variable to the previous record (docmd.move....) and test if it is EOF or BOF and enable the buttons accordingly. If it is not EOF or BOF, set the Form's recordset.bookmark equal to the recordsetclone.bookmark and the form will navigate as directed, only when not EOF or BOF. You don't need to even pop a message, just don't run the move code.

If you only want to write this code once, create a form with the 5 navigation buttons and the record number textbox plus a label showing the record count. Turn off record selectors and lines and all that stuff and now you can drop this form on all your forms as a sub form. Write the code on the sub form to work off of Me.Parent.Recordsetclone. You can set the textbox to the Me.Parent.recordset.absoluteposition and the label.caption to the me.Parent.recordset.recordcount.

(Instead of all this me.parent.recordset mumbo jumbo, create module level variables for parent recordset and recordsetclone and call a public procedure on the subform that sets them from the parent open event (If I recall correctly, the subform open event runs before the parent form open event so there is no parent in existence when the subform opens). There is a way to do this as I have done it in the past. The result is a new 'control' that has all the events hooked up to work with any form from which you call its init method. It probably just works if you do it on the on current event but it is more efficient to call the procedure that initializes the navigation controls in one of the open events.

Ciao
Jürgen Welz
Edmonton AB Canada
[email protected]





Similar Threads
Thread Thread Starter Forum Replies Last Post
what is the right back end database for PHP? charliemears PHP Databases 1 May 21st, 2008 03:44 PM
forum have back-end database? abdul_wasie SQL Server 2000 1 May 9th, 2005 09:11 AM
Using Front-End Application To Update Database Ben Horne Flash (all versions) 5 July 2nd, 2004 02:34 AM
Queries on Back End database? gazolba Access 3 May 1st, 2004 11:30 AM
Problem In Inserting Records in database zaeem Classic ASP Databases 1 October 22nd, 2003 06:35 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.