Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2007

Tip: Looking for answers? Try searching our database.

In a subform datasheet, how to order by a field?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Water dude - 07 May 2007 16:16 GMT
I have a form & subform for data entry. The main form links to a parent table
that contains info about water samples and the subform links to its child
that contains info about many different substances that are analyzed in each
sample.  

The subform is displayed in datasheet view. I would like the records that
are displayed in the form to stay in the order I enter them, so I can stop
data entry and then return without losing my place. But when I close the form
and reopen it, the subform records rearrange themselves--not in any order I
can figure out.

I tried setting the subform's "Order By" property to "ObservationID" (this
is the primary key of the analyses (child) table, and it's an Autonumber that
gets assigned when I create the record). That seems to have no effect.

I read about using a query to provide values for a subform, but that
wouldn't let me enter data, would it?

Thanks for your help.
Maurice - 07 May 2007 18:21 GMT
Why can't a query be a source for your subform, if you link the subform to
the parent and the proper ID-field is presented in the query than you can
enter data in the subform as well..

Maurice

> I have a form & subform for data entry. The main form links to a parent table
> that contains info about water samples and the subform links to its child
[quoted text clipped - 15 lines]
>
> Thanks for your help.
Water dude - 07 May 2007 19:25 GMT
Hey, thanks much. I thought you couldn't change field values in a table by
simply editing the corresponding field in a query based on that table. I see
you can.

> Why can't a query be a source for your subform, if you link the subform to
> the parent and the proper ID-field is presented in the query than you can
[quoted text clipped - 21 lines]
> >
> > Thanks for your help.
George Nicholson - 07 May 2007 20:14 GMT
> I thought you couldn't change field values in a table by
> simply editing the corresponding field in a query based on that table. I
> see
> you can.

It depends upon the Select query. For instance:
- If a Select query is based on multiple tables, it *might* not be editable.
Depends on the complexity of the joins.
- Select Queries with aggregate functions (Sum, Count, etc.)  become
uneditable (a single query record potentially represents multiple data
records, so which records would you expect to get updated, even if it was
allowed?).
- Database functions (Dlookup, etc.) also turn a Select query uneditable. i
believe.

I'm sure this is not an exhaustive list. But simple single-table queries
(the kind you would use as the basis for a form) are almost always editable.

HTH,

> Hey, thanks much. I thought you couldn't change field values in a table by
> simply editing the corresponding field in a query based on that table. I
[quoted text clipped - 36 lines]
>> >
>> > Thanks for your help.
George Nicholson - 07 May 2007 19:21 GMT
Setting OrderBy by itself is only half the job. The OrderByOn property also
needs to get turned on, either by clicking the Sort button on the toolbar or
via code.

Alternatively, create a query that sorts the table by the desired field and
then base the subform on that query.

This is one reason that forms are usually based on queries, not tables
directly: queries give you control over the sort order.

HTH,

>I have a form & subform for data entry. The main form links to a parent
>table
[quoted text clipped - 20 lines]
>
> Thanks for your help.
Maurice - 07 May 2007 20:29 GMT
Well put George....

Maurice

> Setting OrderBy by itself is only half the job. The OrderByOn property also
> needs to get turned on, either by clicking the Sort button on the toolbar or
[quoted text clipped - 32 lines]
> >
> > Thanks for your help.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.