Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Next Record Button to prevent ...

Status
Not open for further replies.

trifest

Programmer
Sep 5, 2002
52
US
How would i go about creating a Record Navigation button that will go to the next record but when it hits the last record it won't go to a new record after the last one so that they can't move past the last record and can only add a new record by hitting a button i added to add one. Thanks guys. [thumbsup]
 
Put code under the go next command button. Let the wiz do the work and you add code to ask if it is rs.eof which is the end of file. If you need help doing that, ask.


rollie@bwsys.net
 
i have a query tied to the form so i'm not sure how i would add the EOF if i'm not using a recordset to check if there are any more records for the form. Thanks for the response though
 
what is the code under your new record button?

rollie@bwsys.net
 
DoCmd.GoToRecord , , acNext

that's about it.
 
Look at Thread702-544148
I put some code in there


Hope this helps
Hymn
 
trifest,

If you were to put this code in front of the above code you can do an assesment. Not the only way jus one.

Dim rs as DOA.recordset, ans as boolean
set rs = me.recordsetclone
ans = false
rs.bookmark = me.bookmark
if rs.eof then
ans = true
endif

rs.close
set rs = nothing
if not ans then
docmd.gotorecord,,, acNew
msgbox "You hit the wall, Charley"
endif

exit sub

rollie@bwsys.net
 
Rollie,

I'm getting a type mismatch error on:

Set rs = Me.RecordsetClone

wonder why that's happening.
 
You have to go to the design mode, then tools, references. This attaches the necessary libraries to your project. When you use DOA recordsets and it's protocol, you have to set Microsoft DAO 3.6 which is a ways down the list. You could probably call the recordset an object and get away with it but don't. Use the wiz and his helps which you will see when you click the DAO 3.6 box.

rollie@bwsys.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top