![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Create a temporary query in a function using Set qryDef = currentdb.CreateQueryDef("", SqlString) on a Jet BE. Do I need to close qryDef or is setting it to Nothing enough. |
#3
| |||
| |||
|
|
paii, Ron wrote: Create a temporary query in a function using Set qryDef = currentdb.CreateQueryDef("", SqlString) on a Jet BE. Do I need to close qryDef or is setting it to Nothing enough. If you don't call an Open method, there is not need to call a Close method. I'd have to look at the documentaion to be sure, but I don't believe there even is a Close method defined for a Querydef object. FWIW, it's not even necessary to set it to Nothing. It will get discarded when it goes out of scope. -- HTH, Bob Barrows |
#4
| |||
| |||
|
|
paii, Ron wrote: Create a temporary query in a function using Set qryDef = currentdb.CreateQueryDef("", SqlString) on a Jet BE. Do I need to close qryDef or is setting it to Nothing enough. If you don't call an Open method, there is not need to call a Close method. I'd have to look at the documentaion to be sure, but I don't believe there even is a Close method defined for a Querydef object. FWIW, it's not even necessary to set it to Nothing. It will get discarded when it goes out of scope. |
#5
| |||
| |||
|
|
Yes there is a Close method, and it does not cause an error when used. Examples in Access help do not use it, or set the object variable to Nothing. I only saw one example when Googling CreateQueryDef. |
#6
| |||
| |||
|
|
Create a temporary query in a function using Set qryDef = currentdb.CreateQueryDef("", SqlString) on a Jet BE. Do I need to close qryDef or is setting it to Nothing enough. |
#7
| |||
| |||
|
|
On Tue, 28 Sep 2010 13:55:31 -0500, "paii, Ron" <none (AT) no (DOT) com> wrote: Create a temporary query in a function using Set qryDef = currentdb.CreateQueryDef("", SqlString) on a Jet BE. Do I need to close qryDef or is setting it to Nothing enough. I'm with David. I haven't created a querydef, temp or otherwise, since about 1997 or so. I also don't have any action queries or queries with parameters. All my action queries are created in VBA code. All my parameters are also specified in code. |
#8
| |||
| |||
|
|
Tony Toews wrote: On Tue, 28 Sep 2010 13:55:31 -0500, "paii, Ron" <none (AT) no (DOT) com wrote: Create a temporary query in a function using Set qryDef = currentdb.CreateQueryDef("", SqlString) on a Jet BE. Do I need to close qryDef or is setting it to Nothing enough. I'm with David. I haven't created a querydef, temp or otherwise, since about 1997 or so. I also don't have any action queries or queries with parameters. All my action queries are created in VBA code. All my parameters are also specified in code. Well, same here before I discovered the advantages of parameters. I very quickly fell in love with never having to type """", as well as never having to worry about delimiters anymore. |
#9
| |||
| |||
|
|
Create a temporary query in a function using Set qryDef = currentdb.CreateQueryDef("", SqlString) on a Jet BE. Do I need to close qryDef or is setting it to Nothing enough. I'm with David. I haven't created a querydef, temp or otherwise, since about 1997 or so. I also don't have any action queries or queries with parameters. All my action queries are created in VBA code. All my parameters are also specified in code. Well, same here before I discovered the advantages of parameters. I very quickly fell in love with never having to type """", as well as never having to worry about delimiters anymore. |
#10
| |||
| |||
|
|
On Fri, 1 Oct 2010 02:11:47 -0400, "Bob Barrows" reb01501 (AT) NOSPAMyahoo (DOT) com> wrote: Create a temporary query in a function using Set qryDef = currentdb.CreateQueryDef("", SqlString) on a Jet BE. Do I need to close qryDef or is setting it to Nothing enough. I'm with David. I haven't created a querydef, temp or otherwise, since about 1997 or so. I also don't have any action queries or queries with parameters. All my action queries are created in VBA code. All my parameters are also specified in code. Well, same here before I discovered the advantages of parameters. I very quickly fell in love with never having to type """", as well as never having to worry about delimiters anymore. shrug> To each thier own. But when you had to come back to a query later it was a pain to figure out what the appropriate parameter values were. Just run the select query, manipulate it a bit and you're done. Note though that I surround string values with ' (single quote). Then you don't have to worry about double, triple or quadruple double quotes. But then you have to worry about escaping apostrophes in the passed strings |
![]() |
| Thread Tools | |
| Display Modes | |
| |