Refresh of subform after new sort order via orderby

G

Guest

Hello,

on my main form, I have a subform which is not linked to the main form. The
record source points to a normal Access table, property orderbyon = true with
orderby statement containing one field as order criteria. I'm using Access
2000.

If I change the orderbyon to another value (e.g. ORDERBY = "col1, col2"),
the subform will not be refreshed even if I call me.subform.refresh or
me.subform.requery as stated in questions already.

Maybe I'm making an error in principle.
 
A

Allen Browne

Set the OrderByOn to True after changing the OrderBy:

Example:
With Me.[Subform1].Form
.OrderBy = "col1, col2"
.OrderByOn = True
End With

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
news:[email protected]...
 
G

Guest

That's what I did already but the refresh is not working. I see that Access
is very sensible if you fire too many refreshs. The control will not always
be refreshed...

Allen Browne said:
Set the OrderByOn to True after changing the OrderBy:

Example:
With Me.[Subform1].Form
.OrderBy = "col1, col2"
.OrderByOn = True
End With

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
on my main form, I have a subform which is not linked to the main form.
The
record source points to a normal Access table, property orderbyon = true
with
orderby statement containing one field as order criteria. I'm using Access
2000.

If I change the orderbyon to another value (e.g. ORDERBY = "col1, col2"),
the subform will not be refreshed even if I call me.subform.refresh or
me.subform.requery as stated in questions already.

Maybe I'm making an error in principle.
 
A

Allen Browne

What refresh?
There is no .Refresh in the suggested code.

Access will have save the record before the reordering can be applied. You
could do that by setting the Dirty property of the form to False.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
That's what I did already but the refresh is not working. I see that
Access
is very sensible if you fire too many refreshs. The control will not
always
be refreshed...

Allen Browne said:
Set the OrderByOn to True after changing the OrderBy:

Example:
With Me.[Subform1].Form
.OrderBy = "col1, col2"
.OrderByOn = True
End With


message
on my main form, I have a subform which is not linked to the main form.
The
record source points to a normal Access table, property orderbyon =
true
with
orderby statement containing one field as order criteria. I'm using
Access
2000.

If I change the orderbyon to another value (e.g. ORDERBY = "col1,
col2"),
the subform will not be refreshed even if I call me.subform.refresh or
me.subform.requery as stated in questions already.

Maybe I'm making an error in principle.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top