|
This works good for sorting by the autonumber field (FAMILYID) but its not good for sorting by date, can someone please tell me how can i change this to sort by the date field which is REF_DT. I substituted REF_DT for FAMILYID below and it just errors out with the error - improper use of variable. The view for adopatients is VWOUTPATIENT and i've tried to use ascending there on the date but that does not work. How can i change recid to something else so it will function any ideas would be very much appreciated.
Private Sub Command1_Click()
' ***** simple sort button *********
Call SortRtn(0, Me.grdOutP.Columns(Me.grdOutP.Col).DataField, Me.grdOutP.Col, "ADOPATIENTS")
' **** end *****
End Sub
Public Sub SortRtn(intSortMode As Integer, strColname As String, intCol As Integer, strAdo As String)
' *************** sort by the autonumber field ************
'A Public Sort Routine
'intSortMode determine sort method 0 for ascending 1 for descending
'strColName determines the column in the grid to sort by
'intCol is the column number
'strAdo determines which grid to sort
Dim recid As Long 'What record are we currently on
Select Case strAdo
Case "ADOPATIENTS"
recid = FRMOUTPATIENT.adoOutP.Recordset.Fields("FAMILYID")
If intSortMode = 0 Then
FRMOUTPATIENT.adoOutP.Recordset.Sort = strColname
Else
FRMOUTPATIENT.adoOutP.Recordset.Sort = strColname & " DESC"
End If
FRMOUTPATIENT.adoOutP.Recordset.Find "FAMILYID = " & recid
End Select
' **** end *****
End Sub
|
|
|
|
|
|
|
// |