• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 496
  • Last Modified:

Subform's OrderBy is being ignored

Working with Access 2000 front-end and SQL Server 2000 back-end...

I have a subform that is resistant to ordering its records by a certain value.  Please read on.

I have a view (qryBrandLots) which combines data from two different tables (LOT and AUCTION).  By default the results are ordered by a value called LotNum, which comes from the LOT table.

qryBrandLots is the record source for a datasheet form (DataForm).  DataForm's OrderBy property is set to qryBrandLots.LotNum, and the Unique Table property is set to LOT.  DataForm is itself used as a subform on another form (MainForm), and MainForm is opened from elsewhere by a command button with the following command in its OnClick event:

   DoCmd.OpenForm stDocName, acNormal, , stFilter

When MainForm opens, the DataForm subform displays the properly filtered records, but they are NOT ordered by LotNum.  Rather, they appear to be ordered by EbayNum -- which is the key value of the AUCTION table that's referenced in the underlying query.

I don't want to have to order the records in the subform AFTER it opens.  How can I get it to pay attention to its own OrderBy property?

Thanks,
Galisteo8
0
Galisteo8
Asked:
Galisteo8
  • 2
1 Solution
 
Bob LambersonSoftware EngineerCommented:
Galisteo8,
> I have a view (qryBrandLots) which combines data from two different
> tables (LOT and AUCTION).  By default the results are ordered by a
> value called LotNum, which comes from the LOT table.
Does this query have the Order By statement in it? maybe you could post the query?

Bob
0
 
bluelizardCommented:
in the subform, instead of specifying "qryBrandLots" as its record source, specify this:

   SELECT * FROM qryBrandLots ORDER BY LotNum

and leave the subform's OrderBy empty (this way, you don't have to deal with the "OrderByOn" property, which must be on for the filter to work and which can only be set programmatically).


--bluelizard
0
 
Galisteo8Author Commented:
BlueLizard,

I'll try your suggestion.  Will post the query for perusal if that doesn't do the trick.
0
 
Galisteo8Author Commented:
Thanks, that got it.  Should have thought of that!

--Galisteo8
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now