I can call a function from any main form and sort it based on a specific requirement.
But if I call the same function from a sub form , the following line fails.
Set frm = Forms(frmName)
Because Access doesn't see a sub form as an opened form.
Is there any way to go around this?
thank you.
Code:
Public Sub ReSortForm (frmName as string)
Dim frm as Form
Dim CurrentSort As String
Set frm = Forms(frmName)
With frm
CurrentSort = .OrderBy
..... Do something here
' Resort form with show order
If SortThis = "Reset" Then
frm.OrderByOn = False
Else
.OrderBy = tbl & SortThis & " " & AscDesc & SecondSort
.OrderByOn = True
End If
End With
..... other actions here
But if I call the same function from a sub form , the following line fails.
Set frm = Forms(frmName)
Because Access doesn't see a sub form as an opened form.
Is there any way to go around this?
thank you.