[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Using parameters in SQL passthrough query

Posted on 1998-10-21
1
Medium Priority
?
404 Views
Last Modified: 2011-09-20
I'm using Access 97 and usign a SQL pass through query to pass a paramter - works fine in normal access query, but not in a sql passthrough query.  [Office] is the parameter in the where clause of a select query, which is used by an Access INSERT query

WHERE substring(tblCurrencySeries.CurrencyCode,1,2) =  [Office]

Doesn't seem to work and it doesn't allow me to set the value of the parameter in code
0
Comment
Question by:tomnich
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 7

Accepted Solution

by:
Victor Spiridonov earned 200 total points
ID: 1090706
You  can't pass parameters to pass-through query. However, there is a workaround- you  can modify query in VBA and then run it. Here is an example: Stored procedure with parameter executed from pas-through query.

Private Sub Pr_report(report_date as date)
Dim passSQL As QueryDef
Dim sql_txt As String
Dim stDocName As String
Dim db As Database
   
   Set db = CurrentDb()
   Set passSQL = db.QueryDefs("sub_for_configuration_report")
   sql_txt = "EXECUTE rep_configuration  '" & Format$(report_date, "mm/dd/yyyy hh:mm") &"'"
        passSQL.SQL = sql_txt
        passSQL.ReturnsRecords = True
       stDocName = "Report1"
        DoCmd.OpenReport stDocName, acPreview


0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question