×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

integrating listboxes selected items into ADO filter

integrating listboxes selected items into ADO filter

integrating listboxes selected items into ADO filter

(OP)
Hi all,
i found difficlties to build the right code to build criteria to an ADO filter based on several selecteditems from list boxes.
does anyone have an idea how it can be done?

RE: integrating listboxes selected items into ADO filter

I can think of two ways.

the first is to loop the selected items and dynamically build a where clause, with each item representing a value. For example you would end up with

WHERE (field = '1' OR field = '2' or field = '3')

etc.

Second item is to have a table at the backend, and for each selected item, insert a value into this table along with the ID of the current user.
You then join to this table on the field with the values in equalling the values in another table, and also on the login ID being the login ID of the current user - which gives you multi user capability.

You have to be careful to erase the current users selections though whenever they run the screen.
An alternative of user ID is to use the spid of the connection, but you then have to be careful of the reuse of different spids by different connections.


John

RE: integrating listboxes selected items into ADO filter





For multi-select, I'd build a function to return a LIST of the selected values like 'val1','val2','val3' then use the list in an IN statement...

CODE

sSQL = sSQL & "Where [FldName] IN (" & NewListFunction(lstBox) & ")"

Skip,

glasses When a group touring the Crest Toothpaste factory got caught in a large cooler, headlines read...
Tooth Company Freeze a Crowd!  and
Many are Cold, but Few are Frozen!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close