Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add Sorting into query

Status
Not open for further replies.

ahhuang

Programmer
Apr 1, 2002
61
SG
Hi all, i have the following code to pass parameter into my Access DB to call a query.
Can i at the same time add statement in vb to sort recordset?
eg i wan to sort by StDate..?

Public Function Get_Reconcile_Qry(tmpdb As Connection, tmpStDate As Variant, tmpenddate As Variant, tmpAccCode As String) As Recordset
Dim x As New Recordset
Dim a As New Command

a.ActiveConnection = tmpdb.ConnectionString
a.CommandType = adCmdStoredProc
a.CommandText = "Bank_Reconcile"
a.Parameters.Append a.CreateParameter("StDate", adDate, adParamInput, , tmpStDate)
a.Parameters.Append a.CreateParameter("EndDate", adDate, adParamInput, , tmpenddate)
a.Parameters.Append a.CreateParameter("Account", adChar, adParamInput, 8, tmpAccCode)

Set x = a.Execute
Set Get_Reconcile_Qry = x

End Function
 
any reason why you don't want to use an SQL-statement to run this query?
 
I'd go with Overdoos and use SQL, maybe something like:

"SELECT ....FROM...ORDER BY"


Everybody body is somebodys Nutter.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top