Hi Joe
If you created a new combo ( [ComboSearch] ) on your form which contained,
for example, the criteria record ID (the bound column) and the name of the
title entry (set the combo columns to 0cm;2cm so the ID is not visible) that
you were looking for the basic AfterUpdate action would be something like
this.
Private Sub ComboSearch_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[CriteriaID] = " & Str(Me![ComboSearch])
Me.Bookmark = rs.Bookmark
End Sub
Obviously if this was an unbound combo it would have the problem that your
search string would be left in the combo until the form was reset which would
be a little distracting so you could add another line of code to clear the
combo after each search. Me.ComboSearch = "" so now the code would look
something like this
Private Sub ComboSearch_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[CriteriaID] = " & Str(Me![ComboSearch])
Me.Bookmark = rs.Bookmark
Me.ComboSearch = ""
End Sub
You say you want to remove all the navigation from the form.
How would a user add a new record ?? In this case if it were me I may be
tempted add some other functions to the combo
You can add many things to your new combo. Such as, if the user simply typed
in the word "Add" (or something else you come up with), you could code the
combo to insert a new record, etc, etc.
The Add code would look something like this so you could either Add the new
record “or†use the same combo to search for existing records.
Private Sub ComboSearch_AfterUpdate()
If Me.ComboSearch = "Add" Then
DoCmd.GoToRecord , , acNewRec
TitleEntry.SetFocus
Else
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[CriteriaID] = " & Str(Me![ComboSearch])
Me.Bookmark = rs.Bookmark
End If
Me.ComboSurnameSearch = ""
End Sub
As you can - in addition to the Add code than I have also put in the
SetFocus so the user don’t have to tab or mouse to the TitleEntry field
(users like things to “just happenâ€). Of course if you don’t like this then
just delete this TitleEntry.SetFocus I assume there is a field called
[TitleEntry] but this will need to be changed.
You will need to alter the codes to show the field names your normally use
but this should set you on the road – I hope.
Oh, one last thought. As I said users like thing to “just happen†so you
could put this on the GotFocus action to make the combo dropdown when it has
the focus
Private Sub ComboSearch_GotFocus()
Me.ComboSearch.Dropdown
End Sub
Basically you can keep adding items to the code until you are happy with the
functionality and the end results - you can insert the code to delete records
as well as add - .
It is a good idea to test each section of the code to make sure it works
before you add in a new item ?? also you will need to alter the codes to show
the field names your normally use but this should set you on the road – I
hope.
Have fun
--
Wayne
Manchester, England.
Not an expert
Enjoy whatever it is you do
Joseph Hand said:
ok, so here is what I want to make happen. I have a form with 60 or so
criteria to manage. I would like to remove all the navigation items and add a
listbox on the side that has one of the records from a row (i.e. title of the
entry) to show in the list box. When you select the title, the rest of the
record shows on that form's main page...
Any ideas?
joe