Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Order By Property on a Subform 1

Status
Not open for further replies.
Sep 21, 2005
17
0
0
US
Given:
A subform -- supported by a query.

I wish the subform to display records based on a field called "Transaction Sequence". The query includes this field an is annoted as "ascending" in the sort order.

The forms works normally most of the time. However, the "Order By" property in the form, which usually contains the term "TransactionSequence" is sometimes overwritten by other field names. Once overwritten -- the user has no means to reset back to "TransactionSequence"

I would like to know how to programmatically set this field using code the "Current" or another appropriate event or whatever works.

Regards,
Pete
 
How about:

[tt]Me.OrderBy="[Transaction Sequence]"
Me.OrderByOn=True[/tt]
 
Hi Remou

I tried that before and now once again -- however I get the message XXXXX cannot find the field "OrderBy" referred to in your expression. I am going to check out the spelling of the parameter -- it might be that there may be a space between the two words -- unlikely but . . . . .
 
Hi Remou

I see the property OrderBy in the property list -- spelled correctly. Me!OrderBy does not properly reference the property -- at least the way I am looking at it. Strange.

This is a subform and the code currently looks like this:

Private Sub Form_Current()
Me!OrderBy = "[TransactionSequence]"
Me!OrderByOn = True

As indicated previously -- it does not like it
 
OrderBy is not a field, so dot not bang.

Me.OrderBy

Not

Me!OrderBy
 
Hi REMOU

This works and you supplied the information I asked for and you deserve the star --- however I now have a secondary quirk. The form is forced into the right order but only the first record of the form (subform with multiple records) can be selected. WHATCHATHINK about that? LOL

Regards,
Pete

BTW -- The code you supplied for highlighted a field selected by cursor works like a charm. I thank you and my users thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top