Sorry, I should have given more detail before.Here is the complete coding I
have for each variation as there may be something I have to adjust that you
can see right away...:
ISNULL Scenerio
Private Sub Form_Open(Cancel As Integer)
DoCmd.Restore
If Forms![Main Review Form]![View Type Subform].Form!View = True Then
Forms![Main Review Form]![View Type Subform].Form!View.Caption = "Admin View"
Me.OrderBy = "IsNull([PI LName]), [PI LName]"
Me.OrderByOn = True
Else
If Forms![Main Review Form]![View Type Subform].Form!View = False Then
Forms![Main Review Form]![View Type Subform].Form!View.Caption = "LOI View"
Me.OrderBy = "IsNull([LOI PI LName]), [LOI PI LName]"
Me.OrderByOn = True
End If
End If
End Sub
Nz Scenerio
Private Sub Form_Open(Cancel As Integer)
DoCmd.Restore
If Forms![Main Review Form]![View Type Subform].Form!View = True Then
Forms![Main Review Form]![View Type Subform].Form!View.Caption = "Admin View"
Me.OrderBy = "Nz([PI LName],'ZZZZZZZ')"
Me.OrderByOn = True
Else
If Forms![Main Review Form]![View Type Subform].Form!View = False Then
Forms![Main Review Form]![View Type Subform].Form!View.Caption = "LOI View"
Me.OrderBy = "Nz([LOI PI LName], 'ZZZZZZZ')"
Me.OrderByOn = True
End If
End If
End Sub
Appreciate any ideas! Thanks!
John Vinson said:
Neither seems to have worked.
What exactly did you do? What "didn't work"? Did you also do what I
neglected to suggest - setting Me.OrderbyOn to True?
For the value to change to ZZZZ do I have to
add in [PI LName]='zzzzzzz' ?
I did not suggest that you change the value to ZZZZZ. I suggested that
you set the Form's OrderBy property to the NZ() function, so that NULL
values will sort last.
I have done what you have suggested for
a report grouping level and it worked, not sure if having it in a form on
open coding changes how it works or if something else would interfere.
My guess is that it's the OrderByOn property still being its default
False value, so that the OrderBy property is being ignored. Sorry I
forgot to mention it!
John W. Vinson[MVP]