473,387 Members | 1,520 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Update form when list selection changes

I have a form that has a textbox used to search records in a table. On
the form I have a listbox which shows each record in the table. When
you click on each row in the listbox the rest of the form updates to
show the other fields in the table.

The problem I am having is when I enter text to search the table the
list narrows successfully, but the rest of the information still
reflects the first record in the table. When I click on one of the rows
in the listbox the rest of the form shows the correct information, but
I would like to have the form update when the selections in the listbox
are narrowed.

For example the listbox shows Row1 and Row2. Row 1 is the current
record in the table and the entire form shows that record. I type
"Row2" in the search box and click a command button that requeries the
listbox. The listbox now only shows Row2, but the rest of the form
still shows data for Row1. When I click on Row2 in the list (this is
the only choice) the form updates and shows the data for Row2. I can't
seem to be able to get the form to update so the first row is selected
and the rest of the form reflects the change.

May 11 '06 #1
3 11050
Brian wrote:
I have a form that has a textbox used to search records in a table. On
the form I have a listbox which shows each record in the table. When
you click on each row in the listbox the rest of the form updates to
show the other fields in the table.

The problem I am having is when I enter text to search the table the
list narrows successfully, but the rest of the information still
reflects the first record in the table. When I click on one of the
rows in the listbox the rest of the form shows the correct
information, but I would like to have the form update when the
selections in the listbox are narrowed.

For example the listbox shows Row1 and Row2. Row 1 is the current
record in the table and the entire form shows that record. I type
"Row2" in the search box and click a command button that requeries the
listbox. The listbox now only shows Row2, but the rest of the form
still shows data for Row1. When I click on Row2 in the list (this is
the only choice) the form updates and shows the data for Row2. I can't
seem to be able to get the form to update so the first row is selected
and the rest of the form reflects the change.


In the code that you run that updates what is shown in the ListBox add the
line...

Me!ListBoxName = Me.ListBoxName.Column(0,0)

Assuming that the ListBox has only one column and no ColumnHeadings showing.
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
May 11 '06 #2
Rick, thanks for your help. I put that code in my command button, and
it does make the first row in my list hilighted, but the data in the
rest of the form still does not reflect the change until I actually
click on the already hilighted row. I tried looking at the clicked
event for the list, but the only code that shows up is code that I put
in there for other functions. Is there a way to force an update by
triggering the clicked event for the list?

May 12 '06 #3
Brian wrote:
Rick, thanks for your help. I put that code in my command button, and
it does make the first row in my list hilighted, but the data in the
rest of the form still does not reflect the change until I actually
click on the already hilighted row. I tried looking at the clicked
event for the list, but the only code that shows up is code that I put
in there for other functions. Is there a way to force an update by
triggering the clicked event for the list?


Sorry I forgot about that. Update events for form controls do not fire if the
control's value is changed from code, only if by the user via the GUI. You just
need to call your ListBox's event procedure from the button code. For instance
if you are using the AfterUpdate event of the ListBox...

Me!ListBoxName = Me.ListBoxName.Column(0,0)
Call ListBoxName_AfterUpdate

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
May 12 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John Doe | last post by:
I have a PHP page that generates a list box with several options in it. I would like to have a "view" link next to the list box. When the user changes the contents of the list box, I would like...
5
by: Jim Cobban | last post by:
I am trying to create a web page in which the contents of one selection list depends upon which element in another selection list is chosen, but where the information to populate the first...
4
by: N. Graves | last post by:
Hello... thank you for your time. I have a form that has a List box of equipotent records and a sub form that will show the data of the equipment select from the list box. Is it possible to...
1
by: Ryan | last post by:
Hello, I have a quick question (I hope). I have a form with a combo box and a multi-selection list box. The list box is based on a query. Users can select values from the cmbobox to add to...
11
by: Siv | last post by:
Hi, I seem to be having a problem with a DataAdapter against an Access database. My app deletes 3 records runs a da.update(dt) where dt is a data.Datatable. I then proceed to update a list to...
30
by: Charles Law | last post by:
Here's one that should probably have the sub-heading "I'm sure I asked this once before, but ...". Two users are both looking at the same data, from a database. One user changes the data and...
16
by: Ian Davies | last post by:
Hello Needing help with a suitable solution. I have extracted records into a table under three columns 'category', 'comment' and share (the category column also holds the index no of the record...
2
by: BOS | last post by:
Hi there, I just create a form that contains name, Address, City, State, Zip, Question Checked box, and dropdown list selection for the user to fill-out the answer in the texbox, checkbox or...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.