How do I move forward and backward in viewing a Re

Results 1 to 3 of 3

Thread: How do I move forward and backward in viewing a Re

  1. #1
    Josh Clark Guest

    Default How do I move forward and backward in viewing a Re

    This is what I need:<BR>to display data in a separate subroutine showing previous database entries. I have a Number field in my Access 2000 database that gets added +1 everytime a record is added. I want to have a form in one routine to write either the current (Number - 1) or (Number + 1) to the querystring so that the separate subroutine can show the main data based on the number in the querystring. Make sense at all? <BR><BR>There will be radio buttons in a form to move forward or backward. When the user selects backward, the previous DB entry will display in the other subroutine.<BR><BR>Thanks for any help. I need it!

  2. #2
    Join Date
    Dec 1969

    Default Very very common usage of ASP...

    ...this is called "paging" a recordset. There are *tons* of articles on the subject on the various ASP "help" sites. Look on 4GuysFromRolla (the "parent" site of this forum), for example. Look on Look on ... well, too many to list.<BR><BR>NOTE: Most of these sites talk about paging by *groups* or records (e.g., going backwards or forwards by say 10 records a time). But your problem is really no just use a page size of 1, that&#039;s all.<BR><BR>

  3. #3
    Josh Clark Guest

    Default RE: Very very common usage of ASP...

    Yeah I see that finally, but I am trying to do it with buttons which is very different. I can&#039;t figure out how to get the form to post the PageNum in the querystring based on which radio button you pick or better yet I&#039;d like to have two buttons. One for forward and one for back. the page now automatically displays the lastest database entry.<BR><BR>Here&#039;s what I have now. The form obviously doesn&#039;t work like the HREF statements yet.<BR><BR>Dim abspage<BR> Dim pagecount<BR> Dim rsNum<BR> Dim strSQL<BR> <BR> <BR> strSQL= "SELECT Num From tblMission"<BR> Set rsNum = Server.CreateObject("ADODB.RecordSet")<BR> rsNum.PageSize = 1<BR> rsNum.CacheSize = 1<BR> rsNum.CursorLocation = adUseClient<BR> rsNum.Open strSQL, dcndb1, adOpenStatic<BR> <BR> If Len(Request("pagenum")) = 0 Then<BR> rsNum.AbsolutePage = 1<BR> Else<BR> If CInt(Request("pagenum")) &#060;= rsNum.PageCount Then<BR> rsNum.AbsolutePage = Request("pagenum")<BR> Else<BR> rsNum.AbsolutePage = 1<BR> End If<BR> End If<BR> <BR> abspage = rsNum.AbsolutePage<BR> pagecount = rsNum.PageCount<BR> <BR> <BR> %&#062;<BR> &#060;a href="dodistest2.asp?action=BrowseInfo&PageNum=1"& #062; 1st page&#060;/a&#062;<BR> &#060;%<BR> If absPage &#062; 1 Then<BR> response.write "&#060;a href=""dodistest2.asp?action=BrowseInfo&PageNum=" _<BR> & absPage - 1 _<BR> & """&#062; previous page&#060;/a&#062;"<BR> End if<BR> If absPage &#060; PageCount Then<BR> response.write "&#060;a href=""dodistest2.asp?action=BrowseInfo&PageNum=" _<BR> & absPage + 1 _<BR> & """&#062; next page&#060;/a&#062;"<BR> End if<BR> <BR> %&#062;<BR> &#060;form name="BrowseInfo" action="dodistest.asp?action=BrowseInfo&PageNum=" Method=POST&#062;<BR> &#060;input type=radio checked name="Direction" value="&#060;"&#062;&#060;<BR> &#060;input type=radio name="Direction" value="&#062;"&#062;&#062;<BR> <BR><BR> &#060;input type="Submit" name="submit" value="Move" &#062;<BR> <BR> &#060;%= numDirection %&#062;<BR> &#060;/form&#062;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts