Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 2nd, 2005, 03:05 PM
Registered User
 
Join Date: Jan 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing multiple values to a pass- through query

Hi Everyone!

I have a listbox with a columm called TableName. The listbox allow multiple selections. Is there a way to store those multiple selections in Access VBA and pass them to a pass through query? It would be great if someone had some code examples?

Thanks a lot for any help!

 
Old July 5th, 2005, 11:16 AM
Authorized User
 
Join Date: Jun 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

look at the vba help for the "Inselect" property. There is a code example there that will help you get the multiple values selected.

You need to build a SQL statement in the form of a string based on those values, and then assign that string to the sql property of the pass thru.

Lets say you have written a function that loops through the selected items of the list box and creates the proper SQL statement. Lets say that that function is called "CrSQLStr". Then:

Dim SQLString as String
Dim CurrDB As Database
Set CurrDB = CurrentDb

SQLString = CrSQLStr(me.ListBox1)
CurrDB.QueryDefs("qryPassThru").SQL=SQLString



 
Old July 7th, 2005, 04:00 PM
Registered User
 
Join Date: Jan 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks!






Similar Threads
Thread Thread Starter Forum Replies Last Post
how to pass multiple values in one parameter yasinirshad Crystal Reports 0 June 3rd, 2008 02:58 AM
pass multiple values to 1 parameter in Crystal 10 ckwizard77 Crystal Reports 0 July 26th, 2007 01:54 PM
How to pass multiple values from Crystal Report to vanitha Crystal Reports 2 June 5th, 2007 07:48 AM
Pass multiple values to XSL? myhtpc XSLT 5 March 17th, 2006 11:16 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.