Sorting in a subform
I have a main form (frmProjects) , a subform (subfrmSites), and a subform within subfrmSites (subfrmProveniences). SubfrmProveniences has two number fields, txtProv_Horiz and txtProv_Vert, neither of which are a primary or foreign key.
I would like to sort subfrmProveniences by txtProv_Horiz then txtProv_Vert in that order, but whenever I change to the next project or site, the sort code that I put into subfrmProveniences no longer works. The code is:
Private Sub Form_Load()
Me.OrderByOn = True
Me.OrderBy = "intProv_Horiz, intProv_Vert"
End Sub
I'm sure that I need to do something to the On Current events for both frmProjects and subfrmSites, and have tried putting the following code into both forms:
Private Sub Form_Current()
Forms!frmProjects!subfrmSites!subfrmProveniences.O rderByOn = True
Forms!frmProjects!subfrmSites!subfrmProveniences.O rderBy = "intProv_Horiz, intProv_Vert"
End Sub
However, I keep getting error 438, saying I can't reference the subform in this manner.
How to I get subfrmProveniences to sort correctly?
Thanks for your help in advance
Bridog39
|