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  

Pass Through Query Parameters



 
 
Thread Tools Display Modes
  #1  
Old July 6th, 2004, 09:26 PM
Stacy
external usenet poster
 
Posts: n/a
Default Pass Through Query Parameters

I'm using an SQL pass through query and would like to run
it based on criteria selected in a form. I've tried to
call the form fields in the SQL statement, but keep
getting errors. Can this be done? It runs if the criteria
is hard-coded in, but there are many different variables.
Any help is much appreciated!!
  #2  
Old July 6th, 2004, 10:53 PM
Lynn Trapp
external usenet poster
 
Posts: n/a
Default Pass Through Query Parameters

With a pass through query, Access turns everything over to the external
database engine. Therefore, the reference to a control on a form is an
unknown quantity to the engine doing the query processing. You will need to
create the query in VBA where you can put the value of the form control into
a variable.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


"Stacy" wrote in message
...
I'm using an SQL pass through query and would like to run
it based on criteria selected in a form. I've tried to
call the form fields in the SQL statement, but keep
getting errors. Can this be done? It runs if the criteria
is hard-coded in, but there are many different variables.
Any help is much appreciated!!



  #3  
Old July 7th, 2004, 02:50 PM
Stacy
external usenet poster
 
Posts: n/a
Default Pass Through Query Parameters

Thanks so much for the reply. I don't have much of a VBA
background... so maybe you can help me figure out the
code to use with this trimmed down example?

I want to show the name of all children (field:
ChildName, ODBC datbase table: dbo.Child) that live in a
country specified by the user entering the country name
in a textbox named "txtCountry" on the form
named "frmChildSearch". This will set the parameter for
the dbo.Child.Country field.

Thank you!

-----Original Message-----
With a pass through query, Access turns everything over

to the external
database engine. Therefore, the reference to a control

on a form is an
unknown quantity to the engine doing the query

processing. You will need to
create the query in VBA where you can put the value of

the form control into
a variable.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


"Stacy" wrote in

message
...
I'm using an SQL pass through query and would like to

run
it based on criteria selected in a form. I've tried to
call the form fields in the SQL statement, but keep
getting errors. Can this be done? It runs if the

criteria
is hard-coded in, but there are many different

variables.
Any help is much appreciated!!



.

  #4  
Old July 8th, 2004, 03:55 PM
Lynn Trapp
external usenet poster
 
Posts: n/a
Default Pass Through Query Parameters

Dim v_Country As String
Dim v_SQL as String

v_Country = Me.txtCountry
v_SQL = "Select * From dbo.Child Where Country = " & v_Country & ";"

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


"Stacy" wrote in message
...
Thanks so much for the reply. I don't have much of a VBA
background... so maybe you can help me figure out the
code to use with this trimmed down example?

I want to show the name of all children (field:
ChildName, ODBC datbase table: dbo.Child) that live in a
country specified by the user entering the country name
in a textbox named "txtCountry" on the form
named "frmChildSearch". This will set the parameter for
the dbo.Child.Country field.

Thank you!

-----Original Message-----
With a pass through query, Access turns everything over

to the external
database engine. Therefore, the reference to a control

on a form is an
unknown quantity to the engine doing the query

processing. You will need to
create the query in VBA where you can put the value of

the form control into
a variable.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


"Stacy" wrote in

message
...
I'm using an SQL pass through query and would like to

run
it based on criteria selected in a form. I've tried to
call the form fields in the SQL statement, but keep
getting errors. Can this be done? It runs if the

criteria
is hard-coded in, but there are many different

variables.
Any help is much appreciated!!



.



 




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
Hidden files in Ms-Query cause ODBC connect errors or Query is wac needyourhelp General Discussion 4 July 12th, 2004 09:38 PM
syntax to run PL/SQL stored proc via ms access pass through query Edwinah63 General Discussion 2 June 23rd, 2004 03:47 AM
pass through parameter query into Oracle teri Running & Setting Up Queries 1 May 27th, 2004 09:33 PM
MS Query Datasource with Parameters G_D_Roberts Mailmerge 1 April 28th, 2004 10:32 PM


All times are GMT +1. The time now is 05:25 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.