I have a query that uses the TOP statement in a querie's SQL. Is there anyway I can have the user answer a prompt to fill in the number that normally appears right after the TOP statement.
I recently overcame a similar issue by modifying the sql string property of the querydef in code - something like this...
Dim strSQL As String
Dim intRecords As Integer
intRecords = InputBox("How Many Records Do You Want?", "Answer The Question"
strSQL = "SELECT TOP " & intRecords & " fieldname, fieldname FROM tblname WHERE blahblahblah"
db.QueryDefs("queryname".SQL = strSQL
This looks really good. I currently just have an SQL statement saved as a query with the one twist being that it calls a procedure called Randomizer()in the criteria. As the reason for the statement is to get say 15 random records for auditing medical records. They change the random total every year using a percentage of total records.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.