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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save Sort Order

Status
Not open for further replies.

stru

Programmer
Mar 23, 2002
10
US
Hi,

I have a continuous form (Form A) which I am able to sort by clicking on the appropriate label. That is, if I wish to sort the form by last name, I click the last name label and it sorts by last name. If I click the first name label, it sorts by first name, etc. On each of the listed records in this continuous form is a "detail" button, which opens another form (Form B) which will give me a more detailed form of the record I wish to view. When I click on this "detail" button Form A stays open and Form B opens on top of it. When I close Form B, it returns to where I was in Form A. That all works fine.

The problem I am having is that when I close Form B and return to Form A I would like to maintain whatever the latest sort that I had applied to Form A. But instead it reverts back to the default sort. Could anyone suggest a way that I could maintain the latest sort? It is actually still listed in the Order By Property of Form A, but I don't know how to reapply it. I have banged my head on this for awhile and figured I would ask.

Thanks.
 
Show us the code behind the "Detail" button

Zameer Abdulla
Jack of Visual Basic Programming, Master in Dining & Sleeping
Visit Me
 
I don't think the code with the detail button is the problem. Pretty standard, but here it is...

Private Sub cmdClientDetail_Click()

On Error GoTo Err_cmdClientDetail_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmClients"
stLinkCriteria = "[Client#]=" & Me![txtClient#]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdClientDetail_Click:
Exit Sub

Err_cmdClientDetail_Click:
MsgBox Err.Description
Resume Exit_cmdClientDetail_Click
End Sub
 
This code does nothing on the requery/reset. It would if it was something like
Code:
stDocName = "frmClients"
stLinkCriteria = "[Client#]=" & Me![txtClient#]
DoCmd.OpenForm stDocName, , , stLinkCriteria, , [b]acDialog
  Me.Requery[/b]
Is there any Me.Requery in any of the Events? Like OnClose of FormB, OnActivate of FormA

Zameer Abdulla
Jack of Visual Basic Programming, Master in Dining & Sleeping
Visit Me
 
There was a requery statement somwhere it shouldn't have been. I thought that I had checked all the code for one, but I hadn't. So, problem solved. Thanks for sterering me in the right direction Zameer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top