473,626 Members | 3,289 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 11088
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_Aft erUpdate

--
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
9694
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 the view link to update to point to the image representing that selection. So for example, if the list box held names of images I would want the view link to always point at the correct image. To further complicate this matter, the selections...
5
2441
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 selection list comves from an SQL database on the web server. There are a couple of these situations in my application but, for example, the first list might be a list of counties, and the second list a list of states/provinces. Obviously the names of...
4
26185
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 make a change in the name field in the details, then refresh the list box with new name? Please help and thanks!
1
3330
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 the list box (items they wish inserted into the table), or they can select items in the list box to delete (from the table). Once they have finished making any changes, they are to click a SAVE button to actually commit the changes to the database....
11
2236
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 reflect that the 3 items have been deleted only to discover that the 3 items appear, however when I click on them to display their information which runs a datareader over the same database it appears that the data has now gone. I wondered whether...
30
3381
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 commits it. How does the other user get the updated view without polling for changes? Is there some sort of callback mechanism that can be set up on the dataset or connection? TIA
16
3483
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 in a hidden field) I wish the user to be able to edit the data in the table, so I have extracted the records into hiddenfield, textareas, dropdown list and checkbox so that they can make changes. I named these elements as arrays and wish to run an...
2
4461
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 choose the selection the option... For example here is the Form properties I setup: Text="Name" Text ID="LabelName" TextBox="TextBoxName" Text="Address" Text ID="LabelAddress" TextBox="TextBoxAddress" Text="City" Text ID="LabelCity" ...
0
8205
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8713
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8644
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8514
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6126
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4094
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4208
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2632
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1516
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.