[AccessD] Multiselect List box

John Clark John.Clark at niagaracounty.com
Thu Apr 17 15:01:51 CDT 2003


Wow...I love this list...Ask, and ye shall receive. Sorry it took so
long to respond, but this program is only running a tad bit late, so of
course they had to stack me up with more s***!!! I love my job...I love
my job...NOPE, NOT WORKING!!!

Anyhow, I used the DoCmd.RunSQL method, because this is what I had in
my head, and was trying unsuccessfully to do before I asked for help. It
worked, but now I am trying to show what is selected and thusly,
unselected, in an adjacent list box. I've got it going into the table,
and that was my major concern, so the rest I imagine will come along.
Worse comes to worse, for now I will leave the text box that I have on
the form. I used this for testing purposes, but it acutally shows the
correct info...only in an "ugly" format.

Now I have to leave this, until Monday. Before y'all think that I am
non-committed to my work, I would choose to work on this for the next
three days straight, but I am not allowed to. Does this make sense? A
company...actually a county government...not allowing an employee to
work on a late project. We're not allowed into our offices any longer
during the weekends, because of budget cuts.

I love my job! I love my Job...damn! Still not working!!! I wonder how
many times I've got to say it to start believing it!

See y'all! Have a great weekend! Oh...and thanks again!

John W Clark



John W. Clark
Computer Programmer / Asst. Network Administrator
Niagara County
Central Data Processing

>>> stuart at lexacorp.com.pg 04/16/03 06:32PM >>>
Lots of ways:
Docmd.RunSQL
.... 
 dim varItm as string
  dim strBrand as string
  dim strSQL as sting
 
     For Each varItm In lstBrand.ItemsSelected
        strSQL = "INSERT INTO myTable (Fld1) Select '" & 
lstBrand.Column(0,varItm) & "'"
     docmd.runSQl strSQL
     Next varItm
.... 

or DAO

...
dim rs as recordset
set rs= currentdb.openrecordset("myTable")

     For Each varItm In lstBrand.ItemsSelected
         rs.addnew
         rs(0) = lstBrand.Column(0,varItm)
         rs.update
     Next varItm
....

or using John's code, you can split the string into array elements
....
Dim myArray()
myArray() = Split(strbrand,",")
....

then do want you want with the array elements.



On 16 Apr 2003 at 14:51, John Clark wrote:

> But how would I take all the items and put them into another table?
I
> am thinking that I'll have to write a routine to separate them and
put
> them into individual records...or I will have to separate a record
> later. There are a ton of directions as to how one goes about
creating
> a multisel. list, but not much as to how to manipulate the data once
> its entered.
> 
> >>> papparuff at attbi.com 04/16/03 11:47AM >>>
> Using Multiselect listboxes are not as difficult as you are making
> them out to be.  Here's some simple code:
> 
>     dim varItm as string
>     dim strBrand as string
> 
>     strBrand = ""
>     ' Get the value of the first column of all items
>     ' selected in a list box
>     For Each varItm In lstBrand.ItemsSelected
>         strBrand = strBrand & lstBrand.Column(0, varItm) & ", "
>     Next varItm
> 
> John V. Ruff - The Eternal Optimist :-)
> Always Looking For Contract Opportunities
> 
> "Commit to the Lord whatever you do,
>  and your plans will succeed." Proverbs 16:3
> 
> 
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com 
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John
Clark
> Sent: Wednesday, April 16, 2003 6:50 AM To:
> accessd at databaseadvisors.com Subject: [AccessD] Multiselect List box
> 
> 
> I am working on a program in A2K, and I may have a need to use a
> multiselect
> list box. Actually, I think it would be best, because the choice
have
> the potential to be altered in the future. However, I have never
used
> multiselects before, and I am wondering how much trouble I'm getting
> into.
> 
> I am all for diving in and learning something new, but I am really
> pressed for time here...this program must be put into operation by
May
> 1st, and I am also playing a major part of moving an office of 200+
> people to a new building, which starts on the 24th...I have to move
> and setup their server and all routers. 
> 
> Should I just make the check boxes for now?  Or are the multiselects
> easier than I am making them out to be?
> 
> I don't think I'd have a problem with their actual setup, but taking
> the selections and putting them into the table is where I am a
little
> confused.
> 
> Thanks!
> 
> John W Clark
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com 
> http://databaseadvisors.com/mailman/listinfo/accessd 
> Website: http://www.databaseadvisors.com 
> 
> 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com 
> http://databaseadvisors.com/mailman/listinfo/accessd 
> Website: http://www.databaseadvisors.com 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com 
> http://databaseadvisors.com/mailman/listinfo/accessd 
> Website: http://www.databaseadvisors.com 


-- 
Lexacorp Ltd
http://www.lexacorp.com.pg 
Information Technology Consultancy, Software Development,System 
Support.



_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com 
http://databaseadvisors.com/mailman/listinfo/accessd 
Website: http://www.databaseadvisors.com


More information about the AccessD mailing list