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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
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 |