pass throug query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can you define a pass-through query from a form's query grid (the same way you do regular pass-throughs)
In other words, I don't want the query in the list of queries, but rather attached to the form. When I define the pass-through from the SQL view of the form query grid, I open properties and there is no place to establish the ODBC connection
Thanks so much for your help
SMK
 
smk2 said:
Can you define a pass-through query from a form's query grid (the same way you do regular pass-throughs)?
In other words, I don't want the query in the list of queries, but rather attached to the form. When I define the pass-through from the SQL view of the form query grid, I open properties and there is no place to establish the ODBC connection.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Your remarks are not very clear. SQL Pass-through queries (SPTs) are in
..mdb files. I believe you are using an .adp file, 'cuz you are saying
the SQL statement is visible at the same time the query grid is visible.
This is only possible in MS SQL Server (and .adp queries).

So,

In .adp files there are no SPTs since all the
queries/procedures/functions/views are stored on the SQL server and the
ODBC connection is part of the .adp file (the
CurrentProject.Connection).

.... in .mdb files you'd do this:

If you want to save the SQL you've already created: copy the SQL
statements to the clipboard (Ctrl-C) before doing the following. When
the query is in design view, from the main menu select Query > SQL
Specific > Pass-Through. If you have the QBE grid displayed the view
will change to the SQL view. Anything you'd created before designating
the query as a pass-thru query would be wiped-out. You'll have to type
in the SQL statement, or paste [Ctrl-V] the SQL you copied to the
clipboard. Note: JET SQL statements don't always work in MS SQL'r -
different dialect.

To see the ODBC connection string: on the main menu bar click View >
Properties. The Properties dialog box will appear. One of the
properties is the "ODBC Connect Str." That is where you'd place the
connection string (obviously).

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQIQvk4echKqOuFEgEQJ8WQCgk2NuG+6MRQQkaYzsm9Ug8LCSEyIAniCy
yPLadXhR0J1CwLTgDnNP6I0C
=5S8G
-----END PGP SIGNATURE-----
 
Thanks for your comments. I realize my question is not clear. I have an .mdb and want to place a pass-through query on a form. Rather than define that under the queries tab (and select the query from the pull-down on RecordSource), I would like to define it directly in the form. When I do that, the properties of pass-through do not show the ODBC connection string or any place I can enter the string. I take that to indicate that MS Access doesn't accomodate writing the pass-through as the recordsource of a form.
 
smk2 said:
Thanks for your comments. I realize my question is not clear. I have an .mdb and want to place a pass-through query on a form. Rather than define that under the queries tab (and select the query from the pull-down on RecordSource), I would like to define it directly in the form. When I do that, the properties of pass-through do not show the ODBC connection string or any place I can enter the string. I take that to indicate that MS Access doesn't accomodate writing the pass-through as the recordsource of a form.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

What I do is set up the pass-thru as a query def and then set the form's
record source as that query def. Use the information I posted as a
reply to your first post, to get how to set the ODBC connection string.

Sometimes I may want to change the parameters of the pass-thru so in the
form's Open event I change the query def's .SQL property. E.g. (run a
stored procedure on the SQL server):

Query name: qryMyPassThruQuery
SQL: Exec usp_GetOrderDetails 2533

Where 2533 is the order number I want the form to display. So, say I
want to see order number 3662; in the form's Open event procedure I'd
change the SQL property of the query "qryMyPassThruQuery."

Private Sub Form_Open(Cancel As Integer)

Dim db as dao.database
dim qd as dao.querydef

set db = currentdb
set qd = db.QueryDefs("qryMyPassThruQuery")
qd.SQL = "Exec usp_GetOrderDetails 3662"
qd.Close
db.Close

End Sub

Actually, I could change the query's SQL property at any point while the
form is open & just Me.Requery to get the new data.

HTH,

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQIRQBYechKqOuFEgEQJwgACgvLgShhLEnZ13XAPm1uuqmxBhp5MAoMiI
tZ9S++IGDXaeI5VsnmMrxoVz
=+hTh
-----END PGP SIGNATURE-----
 
Thanks. THat is very useful information. I haven't used a lot of pass-throughs because my forms ar
bound and I need to edit the fields
SMK
 
Back
Top