Discussion Locked

Using "Find" in Access last to first

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
Is there a way to use Find or something to search from the last record to the first. Something just like the Find (under Edit) except it goes though the DB backwards

7 replies

by dklippert

You could use a query to sort the table in the order you want (First date-first Last date-first) and then use find.

by yatst

Two options.

Open the table you want to search on. Click at the top of the column of the field you need to do your find on. Then click on the z-a button on the toolbar. Next perform your find.

Run a query on the field(s) you need. Sort theappropriate field in Descending order and place the criteria for your find in the criteria line.

Good Luck

by sankulpune

Hello Dutcman,
2.1) Create a form using 'AutoFormat : Tabular' option based on the table.
2.2) Using 'Command Button Wizard' insert a button. Assign 'Record navigation' category and 'Find Record' action to the button.
Assign the picture 'Binoculars2' to the button. Type 'Reverse Find' as the name, click 'finish'.
2.3) Rt-clk on the button just inserted and click on 'Build Event' to display 'Private Sub Reverse_Find_Click()' procedure.
DELETE line
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
and replace with :
'=========
Static fName As String
Static fVal As String
If (Once = True) Then
DoCmd.GoToRecord acActiveDataObject, , acLast
Once = False
fName = InputBox("Type the name of the field to search :")
fVal = InputBox("Type the value to search :")
If (fName = "" Or fVal = "") Then
Exit Sub
End If
Else
DoCmd.GoToRecord acActiveDataObject, , acPrevious
End If
While ((Me.Controls([fName]).Value <> fVal) And (CurrentRecord > 1))
DoCmd.GoToRecord acActiveDataObject, , acPrevious
Wend
If CurrentRecord <= 1 Then
Once = True
End If
'==
DO NOT CHANGE REST OF THE CODE
2.4) In (General) section of the form code, add
Public Once As Boolean
2.5) In the 'Load' event of the Form add:
Private Sub Form_Load()
Once = True
End Sub
Close the form and the open it. Click on the binocular to execute the 'Reverse Find'.
It works!!
A more sophisticated solution can be found out in the form of a menu-item that behaves exctly like the existing 'Find' menu but acts in the reverse way. This off-course will need more efforts & time.
Hope this helps !!
Need any clarifications / more help? Contact me.
with regards,
Sanjay Kulkarni,
'Simple And Effective Solutions to Small Problems, No QuickFixes.'

This discussion is closed to new replies.