RE: form w/ listbox, select record to show the rest on the form...



Thank you - this is awesome! It works!!!

So I wouldn't be American if I didn't ask for more ;-)

I changed it to a listbox. Now, I can make the selection, and it jumps to
that record, but the listbox loses focus and the highlight on the selected
record disappears (the gray outline actually returns to the top). Is there
any way to have the selected record stay highlighted and have the list stay
where it is instead of rolling back to the top?

thanks again!!!!

joe


"Wayne-I-M" wrote:

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" wrote:

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
.



Relevant Pages

  • Re: Select range & copy
    ... I changed the range name of the ListBox stuff to mRefList ... "tvac" wrote: ... > Private Sub ListBox1_Click ... >> The first 2 columns have common data regardless of the selection. ...
    (microsoft.public.excel.programming)
  • Re: Multi select problem
    ... that person's hobbies from the list of all possible hobbies. ... Private Sub ClearHobbySelections() ... Dim rs As DAO.Recordset ... ' Clear the user's selection. ...
    (microsoft.public.access.formscoding)
  • Re: Saving multiselect selections
    ... that person's hobbies from the list of all possible hobbies. ... Private Sub ClearHobbySelections() ... Dim rs As DAO.Recordset ... ' Clear the user's selection. ...
    (microsoft.public.access.formscoding)
  • Re: Listing files in a listbox
    ... Put 'er in the listbox using .Additem ... > subfolders since it didn't sound like you would have that situation. ... > Dim FSO As Scripting.FileSystemObject ... > Private Sub ListBox1_AfterUpdate ...
    (microsoft.public.excel.programming)
  • RE: form w/ listbox, select record to show the rest on the form...
    ... Private Sub ComboSearch_AfterUpdate ... Dim rs As Object ... I changed it to a listbox. ...
    (microsoft.public.access.forms)

Loading