Here's an expanded TOpSQL function with some other database platforms:
Function TopSQL(strSQL, lngRecords)
If ucase(left(strSQL,7))="SELECT " then
'Remove ; at the end of any SQL code
strTempSQL=strSQL
if right(strSQL,1)=";" then strTempSQL=left(strSQL,len(strSQL)-1)
select case strDBType
case "sqlserver65"
TopSQL="SET ROWCOUNT " & lngRecords & vbcrlf & strTempSQL & vbcrlf & "SET ROWCOUNT 0"
case "sqlserver"
TopSQL="SELECT TOP " & lngRecords & mid(strTempSQL,7)
case "access"
TopSQL="SELECT TOP " & lngRecords & mid(strTempSQL,7)
case "mysql"
TopSQL=strTempSQL & " LIMIT " & lngRecords
case "oracle"
TopSQL="SELECT * FROM (" & strTempSQL & ") WHERE ROWNUM <= " & lngRecords
case "sybasease"
TopSQL="SET ROWCOUNT " & lngRecords & vbcrlf & strTempSQL & vbcrlf & "SET ROWCOUNT 0"
case "ibmdb2"
TopSQL=strTempSQL & " FETCH FIRST " & lngRecords & " ROWS ONLY"
end select
Else
TopSQL=strSQL
End If
End Function