Sorting a call log continuous subform (1 Viewer)

TomH

Registered User.
Local time
Today, 13:47
Joined
Nov 3, 2008
Messages
111
Hi all.

I have a call log in a subform (subform is based on a table). Simplest description is Date, Initials, Note. I'd like to sort on the Date descending, which I did in the OrderBy property of the Date control. But, I also want the new entry to be at the top... but it's at the bottom and I don't know how to make it so the new entry would always be at the top.

Thanks for any help!!!
 

Ranman256

Well-known member
Local time
Today, 13:47
Joined
Apr 9, 2015
Messages
4,337
if the query in the form is sorted by [date] desc.
then add a new entry, youd have to refresh F5 for it to sort to the top.
or build a refresh button to do it.
 

TomH

Registered User.
Local time
Today, 13:47
Joined
Nov 3, 2008
Messages
111
if the query in the form is sorted by [date] desc.
then add a new entry, youd have to refresh F5 for it to sort to the top.
or build a refresh button to do it.

There is no query in the form. The subform is based on a subtable with a 1-many relationship on the main form's table's keyfield. The sort works for records already entered... it's just that the next entry record is at the bottom.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 10:47
Joined
Aug 30, 2003
Messages
36,133
You can't move the new record to the top. Workarounds I've seen include:

2 subforms, one in data entry mode above another which doesn't allow additions. Properly done, it would look like a single subform with data entry at the top.

Unbound textboxes above a subform which doesn't allow additions, with code to add a record from them.
 

Ranman256

Well-known member
Local time
Today, 13:47
Joined
Apr 9, 2015
Messages
4,337
query / table same thing. the datasource.

There is no query in the form. The subform is based on a subtable with a 1-many relationship on the main form's table's keyfield. The sort works for records already entered... it's just that the next entry record is at the bottom.
 

TomH

Registered User.
Local time
Today, 13:47
Joined
Nov 3, 2008
Messages
111
Thanks guys. Just before seeing your answer, I finally found a couple old threads on the subject. Looks like you're absolutely right... two subforms is the answer, one for data entry and one for querying the data. Thanks!

Now... if I make a new entry in SubForm1, how do I get SubForm2 to requery? I can set an Enter button control to drive some code at OnClick, but I don't know what to put in there to add the data to the table and requery for the other subform!!!

Thanks again!
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 10:47
Joined
Aug 30, 2003
Messages
36,133
In the after update event of the data entry subform, requery the other one.
 

TomH

Registered User.
Local time
Today, 13:47
Joined
Nov 3, 2008
Messages
111
In the after update event of the data entry subform, requery the other one.

Can you help me with the syntax?

In MainForm, I have EntrySubform and NotesSubform. EntrySubform is for data entry to the table, NotesSubform for querying and displaying the notes after Submit button is pressed. In the Entrysubform Submit button OnClick event property, how do I refer to the NotesSubform to requery? I tried

Forms!MainForm!NotesSubform.Requery

but that didn't work. I just don't know how to reference the other subform in the requery statement. THANKS!
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 10:47
Joined
Aug 30, 2003
Messages
36,133
Perhaps

Forms!MainForm!NotesSubform.Form.Requery

Make sure NotesSubform is the name of the subform control on the main form, if different than the name of the subform itself.
 

TomH

Registered User.
Local time
Today, 13:47
Joined
Nov 3, 2008
Messages
111
Perhaps

Forms!MainForm!NotesSubform.Form.Requery

Make sure NotesSubform is the name of the subform control on the main form, if different than the name of the subform itself.

WINNER.

Thank you!
 

Users who are viewing this thread

Top Bottom