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 April 19th, 2010, 03:41 PM
Registered User
 
Join Date: Apr 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating a QueryDef if columns are dynamically chosen.

Suppose I have a table X with columns a1, a2, a3, a4. There is a form with checkboxes b1, b2, b3, b4. The user can select any combination of these boxes. I need to write the VBA code for a button that will form the SELECT statement which selects those corresponding columns, i.e. if b1 is checked then a1 is in the SELECT clause otherwise it is not and so on.
What would be the most straight forward way to do this?
Actually it's a virtual table from a join of six other tables with many fields to chose from. I will use QueryDef and TransferSpreadsheet to an Excel spreadsheet.

Last edited by nyodn; April 19th, 2010 at 03:48 PM.. Reason: I hit the return button inadvertently before I completed my question.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamically creating columns in temp table girish SQL Server 2000 8 November 14th, 2016 01:35 AM
creating columns in datagrid pady123 ASP.NET 1.x and 2.0 Application Design 0 September 8th, 2007 01:08 AM
Creating Columns Dynamically?? cbeasle1 Crystal Reports 2 June 10th, 2005 09:15 AM
Dynamically Hiding Columns r_ganesh76 Crystal Reports 1 September 23rd, 2004 11:18 PM





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