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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Button that jumps forward/backward more than 1 record...how?

Status
Not open for further replies.

Jakobud

Technical User
Mar 9, 2001
51
US
When you make a command button on a data access page, the only navigation commands you can give that button are next, previous, first and last (records). But my databases consist of 150+ records. I have to be able to navigate to the record I want quickly. I don't want to sit there clicking the 'NEXT' button 70 times...I'm sure there is someway to make a button that jumps forward, lets say 10 records at a time instead of just 1. I don't know hardly anything about Visual basic and stuff but anyone could please point me in the right direction for making a custom button like this I would REALLY appreciate it! Thanks everyone!

Jakobud
 
Hi,

Make a command button. In its click event insert this code to skip 10 records every time it is pressed:

Const kOFFSET = 10
DoCmd.GoToRecord acDataForm, "form1", acNext, kOFFSET

Have a good one!
BK
.
 
Uhhh....please forgive my stupidity/ignorance. That sorta helps me...can you be specific please? Here's my code for the button in the HTML file:

<BUTTON id=Next_Record
style=&quot;BACKGROUND-IMAGE: url(./Navigation_files/image001.bmp); BACKGROUND-POSITION: center center; BACKGROUND-REPEAT: no-repeat; HEIGHT: 25px; LEFT: 416px; POSITION: absolute; TOP: 56px; WIDTH: 22px&quot;
tabIndex=4 title=Command0></BUTTON>
<SCRIPT event=onclick for=Next_Record language=javascript>
try { MSODSC.CurrentSection.DataPage.MoveNext(); }
catch (e)
{ alert (e.description);}
</SCRIPT>

so where do I stick the code exactly? And the 'form1' you have in quotes, do I leave that as form1 or rename it to the name of something else? Like I said, sorry but I am very new to Access and Visual Basic. Thanks a lot for the quick response too!

Jake
 
I think you are in the wrong section you are using script an this is a section for access database .

But anyway I think that it should be a function “move” and you should put it where the “movenext” is now and the argument after it should be the number of records you wont to move forward and if you wont to move back put a negative number (that’s the way it works in VB so maybe its working in script also).

Jn88
 
It looks like your webpage uses Javascript to power that button. How are your Javascript skills? :)

Later,
ErikZ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top