Ordering subforms in Access2K

  • Thread starter Thread starter Tony Wainwright
  • Start date Start date
T

Tony Wainwright

Hi guys,

I have an Access2K application. On many of the forms there are subforms that contain related information. The form's recordsource is the Master table and the sub form's recordsource is the related table.

Some of these subforms do not display this information in a logical order e.g. On 1 form I have a unit no which I would like to see in numerical order, unfortunately this is not the case. To get round this I have used the following code in the Form_Current event of the sub form
Me.OrderBy = "UnitNo"
Me.OrderByOn = True

This does order the sub form, however it doesn't allow me to enter/edit information contained within it.

My question is how can I force the order of a sub form and still allow data to be input or amended?

Cheers
Tony
 
1. You can use a Query with the Order By clause as the RecordSource for the
Subform to sort the Records displayed on the Subform.

2. OrderBy and OrderByOn Properties do NOT change the updateabilty of data
that binds the Subform. If you cannot enter / edit Records on the Subform,
it is caused by something else. Try:

* Check the AllowEdits & AllowAdditions Properties of the Form being used
as the Subform.

* If the RecordSource of the Subform is a Query, check that the Query is
updateable.

* Check for code that changes the AllowEdits and AllowAdditions Properties.

--
HTH
Van T. Dinh
MVP (Access)



Hi guys,

I have an Access2K application. On many of the forms there are subforms
that contain related information. The form's recordsource is the Master
table and the sub form's recordsource is the related table.

Some of these subforms do not display this information in a logical order
e.g. On 1 form I have a unit no which I would like to see in numerical
order, unfortunately this is not the case. To get round this I have used the
following code in the Form_Current event of the sub form
Me.OrderBy = "UnitNo"
Me.OrderByOn = True

This does order the sub form, however it doesn't allow me to enter/edit
information contained within it.

My question is how can I force the order of a sub form and still allow data
to be input or amended?

Cheers
Tony
 
Thanks. I have already checked for code that changes AllowEdits and
AllowAdditions and there isn't any. On the Form properties they are also
set to true. The form is updateable until I turn OrderByOn to true. I have
already changed the Recordsource to a query and this work fine. I was
hoping to find a solution that didn't require a query .... but thanks anyway
 
Back
Top