473,486 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

loop items selected in listbox to edit a field

Access 2003 Front Connected to SQL 2005 Backend

I have a multi-select listbox that shows a filtered list according to
a date range referenced from a ctrl on the form.
I need to update 2 fields on only the selected records. I have tried
a couple of different methods without success.
This is my current code:
Dim i As Integer
For i = 0 To Me.List5.ListCount - 1
'Me.List5.options = dbSeeChanges
strSQL = "SELECT * FROM qDeposit_1 WHERE TransID =" &
Me.List5.ItemData(0)
Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset,
dbSeeChanges)
If rs.RecordCount 0 Then
rs!DepositDate = Date
End If
Next i
Now I am getting a runtime error 3061 too few parameters, expected
2, and it appears to be the "set rs" line that is causeing the
problem.
Am I going about this in the right fashion or should I be trying a
different approach?
As Always
Any and ALL help Appreciated!
Jun 27 '08 #1
1 2636
Dale wrote:
Access 2003 Front Connected to SQL 2005 Backend

I have a multi-select listbox that shows a filtered list according to
a date range referenced from a ctrl on the form.
I need to update 2 fields on only the selected records. I have tried
a couple of different methods without success.
This is my current code:
Dim i As Integer
For i = 0 To Me.List5.ListCount - 1
'Me.List5.options = dbSeeChanges
strSQL = "SELECT * FROM qDeposit_1 WHERE TransID =" &
Me.List5.ItemData(0)
Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset,
dbSeeChanges)
If rs.RecordCount 0 Then
rs!DepositDate = Date
End If
Next i
Now I am getting a runtime error 3061 too few parameters, expected
2, and it appears to be the "set rs" line that is causeing the
problem.
Am I going about this in the right fashion or should I be trying a
different approach?
As Always
Any and ALL help Appreciated!
Perhaps use Column instead of ItemData.

strSQL = "SELECT * FROM qDeposit_1 WHERE TransID =" & Me.List5.Column(0,i)

Por Ti, Baby
http://www.youtube.com/watch?v=9GTF-YYa1VM
Jun 27 '08 #2

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

Similar topics

2
1738
by: Job Lot | last post by:
How can i change the order of items in ListBox on Click of Up and Down button. I want user to rank their Loans in the order they want them to get paid. My database table stores the ranks as numeric...
1
395
by: DCount17 | last post by:
I have used the following code, but I get an error. I'm using C#. When the checkbox is selected, I want to select all items in lstTeams (90 items) so the user doesn't have to manually select each...
2
4282
by: John | last post by:
Hi Is there a way to get the count of selected items in a list? Thanks Regards
2
19417
by: JP | last post by:
Hi, I am trying to loop through the listbox and read the selected items from the list, within a CLICK event on an aspx page. The following is what I have tried. It loops through the listbox,...
2
4850
by: baret bonden | last post by:
Trying to return a selected listbox item to another form .tried lots of ways; defining public variables and passing those as well as textboxes ..I' m able to display the chosen item on it's form...
3
11694
by: kimiraikkonen | last post by:
Hi, I want to display ALL the items (includes unselected items) of listbox control. How can i code this? Should i use "for each" or other? For example: Assume you have a listbox with 3 items...
2
12700
by: Ramk | last post by:
I have a listbox on my form which is bounded to a bindingsource. The collection is of type List<T>. If I add new elements to the bindingsource, I would like to select them in the listbox. A...
14
4026
by: yookify | last post by:
Im Using asp .net with Vb Coding. I have to remove the list of selected items from listbox . Dim i As Integer For i = 0 To listbox1.Items.Count - 1 ...
0
1102
by: MeMeSo | last post by:
Hi I appreciate your help in advance. I'm new to VBA - and would like to know how to add and remove items from a listbox (not the main table) via a subform instantly. 1. Code to populate listbox...
0
7094
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,...
1
6839
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...
0
7305
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...
1
4863
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...
0
3066
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...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
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 ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
259
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...

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.