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

G

Guest

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
 
G

Guest

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
 
G

Guest

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 said:
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
 
G

Guest

Hi Joe

Can you post the code that you used AfterUpdate and also if you have used
any code On Not In List and I will try and have a look

Note. Open the form in design view and use the properties box - Event
column. Open the AfterUpdate code and cut and paste it into this formum.

--
Wayne
Manchester, England.
Not an expert
Enjoy whatever it is you do


Joseph Hand said:
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 said:
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
 
G

Guest

Here is the AfterUpdate code.
***********************************************
Private Sub ComboSearch_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[lngID] = " & Str(Me![ComboSearch])
Me.Bookmark = rs.Bookmark

Me.ComboSearch = ""
End Sub
***********************************************
There is no On Not On List code.

Thanks again for all your help!!!

joe


Wayne-I-M said:
Hi Joe

Can you post the code that you used AfterUpdate and also if you have used
any code On Not In List and I will try and have a look

Note. Open the form in design view and use the properties box - Event
column. Open the AfterUpdate code and cut and paste it into this formum.

--
Wayne
Manchester, England.
Not an expert
Enjoy whatever it is you do


Joseph Hand said:
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 said:
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




:

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
 
G

Guest

Hi Joe

Change the code to this

Private Sub ComboSearch_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[IngID] = " & Str(Nz(Me![ComboSearch], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Just a quick note
For ease of programming it’s not really a good idea to call a “list†box
[ComboSearch] I may have used [ListSearch]. Eventually, when you have
zillions of items on your D Base you will need to find a specific “bit†and
so you need to have some form of regularity in naming conventions. You can
make up your own or copy someone else’s, but either way, just ensure you name
all items from tables and queries to comboboxes and listboxes with an
appropriate and meaningful name.

So - you may want to change the name of the listbox - BUT DON'T FORGET to
change the code above as well.

Let me know if this was helpful

--
Wayne
Manchester, England.
Not an expert
Enjoy whatever it is you do


Joseph Hand said:
Here is the AfterUpdate code.
***********************************************
Private Sub ComboSearch_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[lngID] = " & Str(Me![ComboSearch])
Me.Bookmark = rs.Bookmark

Me.ComboSearch = ""
End Sub
***********************************************
There is no On Not On List code.

Thanks again for all your help!!!

joe


Wayne-I-M said:
Hi Joe

Can you post the code that you used AfterUpdate and also if you have used
any code On Not In List and I will try and have a look

Note. Open the form in design view and use the properties box - Event
column. Open the AfterUpdate code and cut and paste it into this formum.

--
Wayne
Manchester, England.
Not an expert
Enjoy whatever it is you do


Joseph Hand said:
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


:

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




:

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
 
G

Guest

This worked beautifully!! Thank you again!

joe

Wayne-I-M said:
Hi Joe

Change the code to this

Private Sub ComboSearch_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[IngID] = " & Str(Nz(Me![ComboSearch], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Just a quick note
For ease of programming it’s not really a good idea to call a “list†box
[ComboSearch] I may have used [ListSearch]. Eventually, when you have
zillions of items on your D Base you will need to find a specific “bit†and
so you need to have some form of regularity in naming conventions. You can
make up your own or copy someone else’s, but either way, just ensure you name
all items from tables and queries to comboboxes and listboxes with an
appropriate and meaningful name.

So - you may want to change the name of the listbox - BUT DON'T FORGET to
change the code above as well.

Let me know if this was helpful

--
Wayne
Manchester, England.
Not an expert
Enjoy whatever it is you do


Joseph Hand said:
Here is the AfterUpdate code.
***********************************************
Private Sub ComboSearch_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[lngID] = " & Str(Me![ComboSearch])
Me.Bookmark = rs.Bookmark

Me.ComboSearch = ""
End Sub
***********************************************
There is no On Not On List code.

Thanks again for all your help!!!

joe


Wayne-I-M said:
Hi Joe

Can you post the code that you used AfterUpdate and also if you have used
any code On Not In List and I will try and have a look

Note. Open the form in design view and use the properties box - Event
column. Open the AfterUpdate code and cut and paste it into this formum.

--
Wayne
Manchester, England.
Not an expert
Enjoy whatever it is you do


:

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


:

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




:

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
 
G

Guest

Your welcome

If you ask any questions and you feel the answer was helpful it's a good
idea to click the helpful button to give some feedback

I hope your new D Base goes well

--
Wayne
Manchester, England.
Not an expert
Enjoy whatever it is you do


Joseph Hand said:
This worked beautifully!! Thank you again!

joe

Wayne-I-M said:
Hi Joe

Change the code to this

Private Sub ComboSearch_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[IngID] = " & Str(Nz(Me![ComboSearch], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Just a quick note
For ease of programming it’s not really a good idea to call a “list†box
[ComboSearch] I may have used [ListSearch]. Eventually, when you have
zillions of items on your D Base you will need to find a specific “bit†and
so you need to have some form of regularity in naming conventions. You can
make up your own or copy someone else’s, but either way, just ensure you name
all items from tables and queries to comboboxes and listboxes with an
appropriate and meaningful name.

So - you may want to change the name of the listbox - BUT DON'T FORGET to
change the code above as well.

Let me know if this was helpful

--
Wayne
Manchester, England.
Not an expert
Enjoy whatever it is you do


Joseph Hand said:
Here is the AfterUpdate code.
***********************************************
Private Sub ComboSearch_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[lngID] = " & Str(Me![ComboSearch])
Me.Bookmark = rs.Bookmark

Me.ComboSearch = ""
End Sub
***********************************************
There is no On Not On List code.

Thanks again for all your help!!!

joe


:

Hi Joe

Can you post the code that you used AfterUpdate and also if you have used
any code On Not In List and I will try and have a look

Note. Open the form in design view and use the properties box - Event
column. Open the AfterUpdate code and cut and paste it into this formum.

--
Wayne
Manchester, England.
Not an expert
Enjoy whatever it is you do


:

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


:

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




:

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top