Greetings:
Background:
This is on an FE database, records are from a temporarily generated table that ranks results using AutoNumber field "RANK"; the AutoNumber field resets each time the table data is deleted in the FE by VB code once the desired function is processed. I used the methods and code sampled from a Switchboard to impliment a page by page display of results
End State:
User is presented with a Form that displays 10 results at a time, page by page. The caption of the labels on the page is updated to the results of a SQL generated string.
Issue:
The SQL string to pull the results is not properly formatted, errors out. However, variables are producing the desired values
Code with Error:
stSql = "SELECT * FROM [tbl_mroc_pick]"
stSql = stSql & " WHERE [RANK] > " & pstart
stSql = stSql & " AND WHERE [RANK] < " & pend
stSql = stSql & " ORDER BY [RANK];"
Set rs = CreateObject("ADODB.Recordset")
rs.Open stSql, con, 1 ' 1 = adOpenKeyset
Note:
variables pstart and pend are being assigned correctly, in the case of page number 1, pstart = 0 and pend = 11
I simply want the record set to pull records where RANK > 0 and where RANK < 11.
Suggestions?