UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Changing Query's SQL string in runtime    
 
   
andreihortua
post Sep 22 2005, 04:28 PM
Post #1

UtterAccess Addict
Posts: 111
From: Bogota, Colombia



I have a query by form it's string is built with some user criteria.
Query's name is cnsServiciosAfectados
String's name is stSQLPuertosCanales
Event is cbAnexarATemporal_Click()


Please tell me how to do it
Go to the top of the page
 
+
Jack Cowley
post Sep 22 2005, 06:42 PM
Post #2

Retired Moderator
Posts: 37,716
From: The San Francisco Bay Area



I would suggest you take a look at this article and consider using it instead of your current method. It alllows you to leave out criteria or enter criteria in any combination and still work.

Jack
Go to the top of the page
 
+
fkegley
post Sep 22 2005, 07:43 PM
Post #3

UtterAccess VIP
Posts: 23,583
From: Mississippi



Jack, you couldn't do any better than that? LOL
Go to the top of the page
 
+
Jack Cowley
post Sep 23 2005, 08:24 AM
Post #4

Retired Moderator
Posts: 37,716
From: The San Francisco Bay Area



Hiya Frank -

Sorry, that is the best that I could do! Let's face it, some days I am better than others...LOL!

Jack
Go to the top of the page
 
+
andreihortua
post Sep 26 2005, 10:37 AM
Post #5

UtterAccess Addict
Posts: 111
From: Bogota, Colombia



This article is good too.

Let's see...
Go to the top of the page
 
+
andreihortua
post Sep 26 2005, 11:11 AM
Post #6

UtterAccess Addict
Posts: 111
From: Bogota, Colombia



I've read last article I mentioned, but I see no difference between DAO and ADO.

Which is the difference?
Go to the top of the page
 
+
Jack Cowley
post Sep 26 2005, 12:34 PM
Post #7

Retired Moderator
Posts: 37,716
From: The San Francisco Bay Area



The difference is that the code that is supposed to be ADO will not run if you do not have the DAO library checked in References. If you try the code supplied in the article and you do not have the DAO library checked in References you will get an errors and the code will not run...

Jack
Go to the top of the page
 
+
andreihortua
post Sep 26 2005, 02:39 PM
Post #8

UtterAccess Addict
Posts: 111
From: Bogota, Colombia



Thanks Jack this is what I wanted

Dim dbs As Database, qdf As QueryDef
Set dbs = CurrentDb
dbs.QueryDefs.Delete "cnsServiciosAfectados"
Set qdf = dbs.CreateQueryDef("cnsServiciosAfectados", strSQLPuertosCanales)

Thanks a lot, keep it free.

(IMG:http://www.utteraccess.com/forum/style_emoticons/default/yayhandclap.gif)

See you soon.
Go to the top of the page
 
+
Jack Cowley
post Sep 26 2005, 02:42 PM
Post #9

Retired Moderator
Posts: 37,716
From: The San Francisco Bay Area



You are welcome and I am glad you have your code working!

Jack
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 18th June 2013 - 11:44 PM