I have a form where the recordsource is a stored procedure.
This forms shows a list. When the user clicks on a column title, the column is sorted by using OrderBy in VBA:
f.i.:
Private Sub lblCode_Click()
Me.OrderBy = "strCode"
End Sub
As a result, in the properties of the form, for the property Order By, the fieldname is filled in (f.i. strCode).
This works fine, but when the form is closed, access saves the property Order By.
Next time the form is opened, it gives an error: The recordsource <storedprocedurename> specified on this form does not exist.
When I remove the fieldname in the Order By property of the form, the form opens without an error.
I have tried to clear the Order By property by using Me.OrderBy = "" in the Close event of the form, but this does not work.
Any solution ?
This forms shows a list. When the user clicks on a column title, the column is sorted by using OrderBy in VBA:
f.i.:
Private Sub lblCode_Click()
Me.OrderBy = "strCode"
End Sub
As a result, in the properties of the form, for the property Order By, the fieldname is filled in (f.i. strCode).
This works fine, but when the form is closed, access saves the property Order By.
Next time the form is opened, it gives an error: The recordsource <storedprocedurename> specified on this form does not exist.
When I remove the fieldname in the Order By property of the form, the form opens without an error.
I have tried to clear the Order By property by using Me.OrderBy = "" in the Close event of the form, but this does not work.
Any solution ?