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

Ascending order on text field 1

Status
Not open for further replies.

integritycare

Technical User
Mar 12, 2011
151
AU
Hello,

I would like to know how to write some code so that when an invoice is 'saved' by a command button that a clients last name is put into ascending order. I know that it can be done by using the 'Sort ascending', but just to make it full-proof for the users.

Many thanks,

Integrity
 
You need to Requery the Record Source after saving the New Record. People frequently try to avoid doing this because Focus returns to the first Record in the Form.

To Requery the Record Source and then return to the New Record:


Where [UniqueID] is a Field unique to only one Record:

Where [UniqueID] is Text

Code:
 Private Sub SaveRequeryReturn_Click()

Dim UF_Rec As String
   
   UF_Rec = Me!UniqueID
   Me.Requery
   Me.Recordset.FindFirst "[UniqueID] = '" & UF_Rec & "'"

End Sub

Where [UniqueID]is Numeric

Code:
 Private Sub SaveRequeryReturn_Click()

Dim UF_Rec As Integer
   
   UF_Rec = Me!UniqueID
   Me.Requery
   Me.Recordset.FindFirst "[UniqueID] = " & UF_Rec

End Sub

Linq ;0)>


The Missinglinq

Richmond, Virginia

The Devil's in the Details!
 
Hi Guys,

many thanks for your replies.

The support query for the Continuous form has the Lastname's sort set to "ascending." The problem is that when records are added the user will when finished print the report to PDF. It seems that the sort order has no order.
So just to force the user to do what is expected and that is to sort the records before printing. I will try the concepts that you guys have written.
I am still mindful of Duane's comment a couple of posts ago that we spend more time trying to solve issues that can be solved by training! I agree with this, but even though we have training, instruction manuals etc it just dose not happen! So hence the need for some solution.

Many thanks,

Integrity
 
It's always amazing to me that a company will spend thousands, or even tens of thousands, of dollars buying software, and then balk at paying employees to attend a class or two to learn how to use it properly!

The Missinglinq

Richmond, Virginia

The Devil's in the Details!
 
Hi Dhookam,

All Invoice printing is done to reports.
The report uses the same query as the form, whether I need to use a separate query for the report with the "Last name" set to "ascending."
I will try this first I think before I spend to much time with it.

Many Thanks,

Integrity

 
Hi dhookom,
Thanks for that. I'm sure that setting up the report in this manner will solve the issue.

Integrity
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top