Sort order in If Then statement

ppoindexter

Registered User.
Local time
Today, 08:46
Joined
Dec 28, 2000
Messages
134
i have the following code for a combo box on a form and i need to have it sort by ascending order....



If IsNull(Me.cmbreflist) = True Then
If IsNull(Me.CmbLevel3) = True Then
CmbWarmup.RowSource = "select fldtplanid,fldmimtplanlabel from tblmimtplan where fldmim_core_id=1 and fldlevel1id=" & Me.cmbNCTM & " and fldlevel2id=" & Me.cmbGrade
Else
CmbWarmup.RowSource = "select fldtplanid,fldmimtplanlabel from tblmimtplan where fldmim_core_id=1 and fldlevel1id=" & Me.cmbNCTM & " and fldlevel2id=" & Me.cmbGrade
End If
Else
CmbWarmup.RowSource = "select fldtplanid,fldmimtplanlabel from tblmimtplan where fldmim_core_id=1 and fldlevel1id=" & Me.cmbNCTM & " and fldlevel2id=" & Me.cmbGrade & " and fldmimid in (select fldmimid from tblmimreference where fldreferencelistid=" & Me.cmbreflist & ")"
End If

Me.tblmimtplan_subform2.LinkMasterFields = "fldmimidWU"
 
i figured it out...at least this works for me...the following example is how i made the records sort in alphabetical order


CmbWarmup.RowSource = "select fldtplanid,fldmimtplanlabel from tblmimtplan where fldmim_core_id=1 and fldlevel1id=" & Me.cmbNCTM & " and fldlevel2id=" & Me.cmbGrade order by fldmimtplanlabel


THIS WILL ORDER BY ASCENDING AS "ASC" IS THE DEFAULT IF YOU NEED DESCENDING

order by fldmimtplanlabel DESC
 

Users who are viewing this thread

Back
Top Bottom