A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Best Way to Dynamically Alter the Select List of A Query



 
 
Thread Tools Display Modes
  #1  
Old September 16th, 2005, 04:18 PM
A. Smart
external usenet poster
 
Posts: n/a
Default Best Way to Dynamically Alter the Select List of A Query

With respect to my earlier post, I am trying to find the best way to
dynamically alter the select list of a query.
Any suggestions!!
Cheers
--
Regards

Ashley Smart
  #2  
Old September 16th, 2005, 04:37 PM
Jeff Boyce
external usenet poster
 
Posts: n/a
Default

Ashley

Answered in your earlier post.

Another (BUT MUCH CLUNKIER) approach would be to build as many different
queries as you would need for any/all combinations of choices on your form.
Then, in code behind your form, values in fields would be tested to
determine which query to run. CLUNKY! INELLEGANT!

Regards

Jeff Boyce
Access MVP


"A. Smart" wrote in message
...
With respect to my earlier post, I am trying to find the best way to
dynamically alter the select list of a query.
Any suggestions!!
Cheers
--
Regards

Ashley Smart



  #3  
Old September 16th, 2005, 05:01 PM
oozyscab via AccessMonster.com
external usenet poster
 
Posts: n/a
Default

I do this all the time in code simply by altering the SQL of the querydef,
like this...

Function ModifyQuery(sQueryName As String, sSql As String) As Boolean
On Error GoTo Err_ModifyQuery

Dim dbModify As DAO.Database
Dim qdfModify As DAO.QueryDef

Set dbModify = CurrentDb
Set qdfModify = dbModify.QueryDefs(sQueryName)
qdfModify.sql = sSql

ModifyQuery = True

Set qdfModify = Nothing
Set dbModify = Nothing

Exit Function
Err_ModifyQuery:
ModifyQuery = False
Err.Raise Err.Number, Err.Source, Err.Description
End Function


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/200509/1
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Using "Multi Select" Feature with a List Box on a Form [email protected] General Discussion 3 June 21st, 2005 05:24 PM
Add contacts to "Select Names" list Old Shrimp General Discussion 1 April 30th, 2005 01:29 AM
Top 20 and bottom 20 values Brian Camire Running & Setting Up Queries 9 January 8th, 2005 01:36 AM
Multi Select List to a Report Dev Ashish Cyndi General Discussion 3 September 6th, 2004 08:52 AM
Excel Worksheets Richard General Discussion 2 July 8th, 2004 04:34 AM


All times are GMT +1. The time now is 07:00 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.