473,396 Members | 1,892 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,396 software developers and data experts.

Multiple Select in Access 2003

54
Hi

I'm using a statement to call other Subs if a unit (or multiple units) in a multi-select list box has been selected (and if not - do nothing). I know that the part below in Bold and Underlined is wrong but I cannot think of what it should be. I've tried a few variations of that part but still it doesn't work. By any chance can you help me with this? Basically i want this for loop to go through the list box (cmbUnit) and for every item selected call one of the two functions in the inner IF statement.

Expand|Select|Wrap|Line Numbers
  1.         ElseIf optWho.Value = 2 Then    
  2.             For j = 0 To (cmbUnit.ListCount - 1)
  3.                 If cmbUnit.Value = True Then 
  4.                 cmbUnit.ListIndex = j 
  5.                    If optFormat.Value = 1 Then
  6.                        Call SaveUnitNEWxls(MYnewFolder)
  7.                    ElseIf optFormat.Value = 2 Then
  8.                        Call SaveUnitNEW(MYnewFolder)
  9.                    End If
  10.                 End If
  11.                 ProgBarGo.Value = ProgBarGo.Value + 1
  12.             Next j
  13.         End If
  14.  
Your help is greatly appreciated. Thanks for your time
Nov 6 '09 #1
2 2270
topher23
234 Expert 100+
The problem, I think, is that you're using a multi-select box, but ListIndex sets a single selection, and then you lose your original multiple selections. Try this code out:

Expand|Select|Wrap|Line Numbers
  1.         ElseIf optWho.value = 2 Then
  2.             For J = 0 To (cmbUnit.ListCount - 1)
  3.                 If cmbUnit.Selected(J) = True Then
  4.                    If optFormat.value = 1 Then
  5.                        Call SaveUnitNEWxls(MYnewFolder)
  6.                    ElseIf optFormat.value = 2 Then
  7.                        Call SaveUnitNEW(MYnewFolder)
  8.                    End If
  9.                 End If
  10.                 ProgBarGo.value = ProgBarGo.value + 1
  11.             Next J
  12.         End If
  13.  
If the subroutines you are using need to reference the list box field's value, set them to accept the J value as an argument and then reference cmbUnit.ListIndex(J) instead.
Nov 6 '09 #2
g diddy
54
Thank you very much for your quick response! i'll give it a try now!
Nov 6 '09 #3

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

Similar topics

0
by: dregier | last post by:
attached is my full query that I am currently working on: Declare @counterday1 int Declare @counterday2 int set @counterday1 = '20' set @counterday2 = '629' Declare @CounterMin07_01 float...
3
by: B | last post by:
Using SQLServer ver 7.0, two tables: TableA = contains all inventory data TableB = contains four fields: ID, source, date_from, date_to This is where multiple range of dates are populated. Sample...
27
by: Simon Templar | last post by:
Hi, I am trying to introduce a multiple datepicker into a webpage and the problem arises with the second picker. I tried to copy and adapt the code I employed for the first one, renaming the...
5
by: Baldy | last post by:
Hi all, just came across a reall tricky one, perhaps some smart cookie out there can help. I'm querying patient data from our hospital it might look like this UR Date ...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
12
by: Scott | last post by:
Front-end Access 2000 I have a stored procedure that has 2 parameters BusinessUnitID and Year. It returns multiple record sets (5 to be exact). I thought I could use a Pass through query but...
1
by: Keith G | last post by:
Hi I'm using VS 2003 to create a database application connecting to an Access database through OleDb. I've used the OleDbDataReader many times to populate comboboxes or treeviews but only...
37
by: Allen Browne | last post by:
If you develop for others, you probably have multiple versions of Access installed so you can edit and create MDEs for clients in different versions. This works fine under Windows XP, even with...
3
by: Barry Edmund Wright | last post by:
Hi All, I have an MS Access DB (2003) with frontend on PC (xp) and backend on Server (2003). I can open multiple instances from this PC. I make a duplicate copy of the MS Access DB and put it onto...
1
by: KrazyKasper | last post by:
Access 2003 – Multi-Column List Box – Select Multiple Items I have a multi-column (3 columns) list box that works well to select one set of records or all sets of records (based on the first field...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...
0
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...
0
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
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...
0
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,...

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.