473,761 Members | 2,455 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Refreshing a two column list box after updating records in the source table

4 New Member
Apologies in advance. I've seen similar questions, but none of the solutions seem to be working for me...

I have a form that allows a user to select mutiple items (payroll deduction codes) in a list box. The values are drawn from a table called PayrollCodes. In the second list box, the user chooses a category that the items from the first list belong to. I have a command button with code attached to the OnClick Event that then records the category selected to the records that match the payroll deduction codes selected. I have a third list box (CodeAndCategor y) that shows the values in the table PayrollCodes. There are two columns in this list box- one for the payroll code and one for the category. I would like this CodeAndCategory list box to show the updated information after the command button is pressed and the table updated. As I have it now, I have the following code right before the function ends:

Expand|Select|Wrap|Line Numbers
  1. Me.CodeAndCategory.Requery
  2. Me.Repaint
If I scroll the listbox down and back up, the record in CodeAndCategory refreshes. If I manually close and open the form, CodeAndCategory refreshes.
I have tried using code to close and reopen the form, but that did not work.
Will be happy to include all code if need be.
Sep 21 '07 #1
4 1986
barry07
47 New Member
I'm guessing, but try Refresh or Requery - Repaint only reformats the screen it does nothing with data.
You may have to Requery/Refresh each combo box.
If that doesn't work can you post the RowSource for each combo box?
Sep 21 '07 #2
Clint Schaefer
4 New Member
Thanks so much for your quick response. I have modified the code as follows:

Expand|Select|Wrap|Line Numbers
  1. Me.CodeList.Requery
  2. Me.CatList.Requery
  3. Me.CodeAndCategory.Requery
  4. Me.Refresh
and still the same issue. Here are the Rowsource contents:

For listbox CodeList:
Expand|Select|Wrap|Line Numbers
  1. SELECT tblUniqueCodes.Code FROM tblUniqueCodes; 
For listbox CatList:
tblProdCats

For listbox CodeAndCategory :
tblUniqueCodes

Thanks again for your help!!
Sep 21 '07 #3
Denburt
1,356 Recognized Expert Top Contributor
I don't see any issues with what you posted but I also don't see the subsequent combo boxes criteria however since your last post I can skip to the point since it sounds like the code requery or what have you is running before the process of updating your table has finished. The solution for that would be to use either "DBEngine.I dle" or try "DoEvents" to see if that helps. Let us know how things go.
Sep 27 '07 #4
Clint Schaefer
4 New Member
Thank you for the response. I had almost given up on hearing anything, so I apologize for just now trying your suggestion.

No luck... Here is the new code. I'm not familiar with DBEngine.Idle, so I hope I used it correctly.

Expand|Select|Wrap|Line Numbers
  1. CodeListItems = [CodeList].ListCount - 1
  2. For CodeListCounter = 0 To CodeListItems
  3.     If [CodeList].Selected(CodeListCounter) = True Then
  4.     rst.Open "SELECT * FROM tblUniqueCodes WHERE (tblUniqueCodes.Code) = '" & Me![CodeList].Column(0, CodeListCounter) & "'", CurConn, , , adCmdText
  5.     rst![ProdCat] = Me![CatList]
  6.     rst.Update
  7.     rst.Close
  8.     End If
  9. Next CodeListCounter
  10.  
  11. DBEngine.Idle
  12.  
  13. Me.CodeAndCategory.Requery
  14.  
  15. MsgBox "The codes have been associated with the " & Forms![Multi List Test]![CatList] & " category."
  16.  
  17. Exit_Command8_Click:
  18.     Exit Sub
  19.  
  20. Err_Command8_Click:
  21.     MsgBox Err.Description
  22.     Resume Exit_Command8_Click
  23.  
  24. End Sub
The interesting thing is you'll notice I have a confirmation message box pop up for the user. If you click, hold down the mouse button for a second, and release, this works great and the List Box is updated. If you click and release too quickly, no update to the table.
Oct 5 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
8193
by: Bernard André | last post by:
Hi All, context: I am using Access 97 tablkes with VB. I can see records in the MDB, using Adodc and datagrid. No problem. But when doing: rsprivate.AddNew rsprivate!For = rsusers!identification rsprivate!Receivedon = ladate
5
3306
by: Scott Tilton | last post by:
I am having a terrible time getting this to work. I am hoping someone out there can help me with very specific code examples. I am trying to get the linked tables in my Access 97 database to be updated whenever the database opens. I need to have them updated based on an INI file that resides in the same directory as the current database. I do not need or want the ability to open a dialog box to pick the location. I simply want it to...
20
2765
by: Steve Jorgensen | last post by:
Hi all, I've just finished almost all of what has turned out to be a real bear of a project. It has to import data from a monthly spreadsheet export from another program, and convert that into normalized data. The task is made more difficult by the fact that the structure itself can vary from month to month (in well defined ways). So, I used the SQL-centric approach, taking vertical stripes at a time so that, for instance, for each...
0
1767
by: | last post by:
I am updating MS access tables with data in an xml document. I create two dataset, one for existing data and one for new data. I fill the first dataset with the records from MS Access, the second with data from the xml Document. Both datasets are populated properly. When the new data contains records that exist in the existing Access table but with changes in individual elements, the matching records in the first dataset are not changed...
1
8839
by: Vinny Vinn | last post by:
I would like to insert a new column in DataTable at a specified position at runtime. Unfortunatly, the DataColumnCollection does not expose any method to do this (like AddAt),Any ideas would be greatly appreciated? Vinny
6
5072
by: Alpha | last post by:
I retrieve a table with only 2 columns. One is a auto-generated primary key column and the 2nd is a string. When I add a new row to the dataset to be updated back to the database. What should I do with the 1st column ? (Below I have a "1" in place for now). Also, Does the datase.AcceptChanges(); updates the changes to the database? Which command do I use to update the changes in dataset back to the Access database table? Thanks, Alpha...
13
4180
by: nyt | last post by:
I have a problem of number and text field. I got the database file(mdb) that contains many combo boxes used and its list values are created by "value list" For eg field Field name= 'furniture' , data type='Number' ,Display Control='Combo Box', RowSource Type = 'Value List' and Row Source = ' 0;"chair";1;"Table";2;"Bed" ' Therefore, in data sheet view of table, if we select (1 : Table ) ,
5
25579
by: Ken | last post by:
I'm trying to run a loop to capture column property information from a table in my datasource. Can anybody see where this is going wrong? Dim tbl As New DataTable Dim col As DataColumn Dim x As Integer Dim colName(99) As String Dim colType(99) As String cn.Open() tbl = cn.GetSchema("Orders") 'Orders is a table in the
5
6961
by: handoyo | last post by:
Hi all,i'm trying to show updated data in existing html td.. For example i got column that show last modified datetime,then i want to update data again,the column will changed to current time without refreshing the page.These are my codes views/order_home <script type="text/javascript" src="<?php echo base_url(); ?>js/jquery.js"></script> <script type="text/javascript" src="<?php echo base_url(); ?>js/jquery.form.js"></script> <script...
0
9522
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9336
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
10111
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...
1
9902
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9765
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...
0
8770
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7327
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
5215
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...
3
3446
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.