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: - Me.CodeAndCategory.Requery
-
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.
4 1986
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?
Thanks so much for your quick response. I have modified the code as follows: - Me.CodeList.Requery
-
Me.CatList.Requery
-
Me.CodeAndCategory.Requery
-
Me.Refresh
and still the same issue. Here are the Rowsource contents:
For listbox CodeList: - SELECT tblUniqueCodes.Code FROM tblUniqueCodes;
For listbox CatList:
tblProdCats
For listbox CodeAndCategory :
tblUniqueCodes
Thanks again for your help!!
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.
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. - CodeListItems = [CodeList].ListCount - 1
-
For CodeListCounter = 0 To CodeListItems
-
If [CodeList].Selected(CodeListCounter) = True Then
-
rst.Open "SELECT * FROM tblUniqueCodes WHERE (tblUniqueCodes.Code) = '" & Me![CodeList].Column(0, CodeListCounter) & "'", CurConn, , , adCmdText
-
rst![ProdCat] = Me![CatList]
-
rst.Update
-
rst.Close
-
End If
-
Next CodeListCounter
-
-
DBEngine.Idle
-
-
Me.CodeAndCategory.Requery
-
-
MsgBox "The codes have been associated with the " & Forms![Multi List Test]![CatList] & " category."
-
-
Exit_Command8_Click:
-
Exit Sub
-
-
Err_Command8_Click:
-
MsgBox Err.Description
-
Resume Exit_Command8_Click
-
-
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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
|
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...
|
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...
|
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...
|
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
| |
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...
|
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 ) ,
|
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
|
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...
|
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...
|
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,...
| |
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...
|
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,...
|
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...
|
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...
|
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...
|
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...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |