Go to a Record

ASP-db provides two ways to enable the navigation to a record. One is via an input box in the navigation bar and the other is via a URL parameter. in either case the "NavGotoFldIndex" keyword must be set to a field ordinal number. If only the user URL setup is desired then set  ShowNavGoto to False to hide the Go button in the navigation bar. 

Property Syntax

X.dbOptions = "NavGotoFldIndex=Field Ordinal index, ShowNavGoto=True"
http://MyServer/MyProgram.asp?aspDBgoto_Unit="N(th record) | +Page | %Prefix"

Example

X.dbOptions = "NavGotoFldIndex=0, ShowNavGoto=False"

Note: Going to a record directory via a record sequence number is not an accurate way of positioning the record pointer as if record(s) are inserted/deleted before the destination record, the positioning will be off. User must evaluate the pros and cons of using this approach. However, locating a record via the key and prefix is more accurate.

<%
Set X= Server.CreateObject("ASP.DB")
X.dbUnit = 1
X.dbMode = "Dual-Horiz"
X.dbDSN = "DSN=CARDB"
X.dbGridDisplayFlds = "Car, Manufacturer, Year"
X.dbOptions = "NavGotoFldIndex=0"
X.dbSQL = "SELECT Car,Manufacturer,Year,Transmission,Price,Engine,MPG,Picture,Comment FROM CarSpecs order by 1"
X.ASPdb
%>

In the above module, the "NavGotoFldIndex" keyword setup the navigation to a record. This navigation act is only valid for a single pass. That means, after navigation to the record, the setup will be erased and subsequent navigation (next, prev etc..) will be in a normal manner.

Look at the navigation bar, a "go" button is displayed with a text box next to it. There are three options for this input box -

  1. A plain number (10,15,65 etc...) w/o any prefix. This means go to the nth record.
  2. A number with the "+" prefix (+n). This means go to the nth page. Page size is determined by the dbGridInc.
  3. Any text prefixed by "%". This means go to the first record where prefix of field NavGotoFldIndex is equal to the text.

The other navigation method is via the URL directly in which user designate which module' display will start at which record. This is especially useful when a record location is generated by module #1 and module #2 need to got the same record.  For example - 

  1. http://MyServer/MyProgram.asp?aspDBgoto_99=53 will navigate module with unit 99 will stat at record 53.
  2. http://MyServer/MyProgram.asp?aspDBgoto_1=%2B3 will navigate module with unit 1 will stat at page 3.
  3. http://MyServer/MyProgram.asp?aspDBgoto_3=%25F will navigate module with unit 3 will stat at record where prefix of field NavGotoFldIndex is equal to "F".

Note:  User must URLencode the "+" and "%" as %2B and %25. Do not input something like http://MyServer/MyProgram.asp?aspDBgoto_99=+3 as +3 will be interpreted as "space 3"