Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Greetings,
I have a listbox with user selections. I would like to be able to return a string of the selected values from the listbox. GetSelectedValues returns something other than a string. Does anyone know if this is possible to do?
Thanks,
Frank
Thanks whiteline. I solved my problem. I created a hidden sheet. On the hidden sheet I put a text object. The text is =CHR(40)&CHR(39)&getfieldselections(AccountNo,CHR(39)&','&CHR(13)&CHR(39),2000)&CHR(39)&CHR(41)In the macro I process the string like this:
Set TX = ActiveDocument.getSheetObject("TX01")
Then i run a SQL Statement through an ADODB connection
ADODBConn.Execute(Update [databasename].[dbo],[tablename] set [fieldname] = 1 where [AccountNo] in "&TX.GetText)
Hi.
You can easily get all possible values using =Concat(distinct YourField, ', ')
Thanks for the rapod reply. I really don't need possible values unless those are the values selected by the user. The SQL that I want to use would be like "update Accounts Set active = 1 where AccountNumber in (this is where the selcted listbox values go)"
You can check if there are some selection with another function.
Thanks whiteline. I solved my problem. I created a hidden sheet. On the hidden sheet I put a text object. The text is =CHR(40)&CHR(39)&getfieldselections(AccountNo,CHR(39)&','&CHR(13)&CHR(39),2000)&CHR(39)&CHR(41)In the macro I process the string like this:
Set TX = ActiveDocument.getSheetObject("TX01")
Then i run a SQL Statement through an ADODB connection
ADODBConn.Execute(Update [databasename].[dbo],[tablename] set [fieldname] = 1 where [AccountNo] in "&TX.GetText)
So its limited with the 2000.
I meant that you could use getselectedcount() to check if there is any selection and then use concat() to build the same list.