Unix Technical Forum

Parameters for Pass-thru query (Help!)

This is a discussion on Parameters for Pass-thru query (Help!) within the MS SQL ODBC forums, part of the Microsoft SQL Server category; --> I have three pass through queries set up in my Access database that are linked via ODBC to MSSQL ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > MS SQL ODBC

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-16-2008, 02:39 PM
Chantal A
 
Posts: n/a
Default Parameters for Pass-thru query (Help!)

I have three pass through queries set up in my Access database that
are linked via ODBC to MSSQL server. All three queries call an s_proc
in sequel and function properly and process the data as expected. My
problem is that the parameters (FromDate and ToDate) are being entered
via three different Access forms--one form for each query. I would
like for one form to execute all three pass through queries. How can
I make this work?

Is it possible for me to call the procedure2 at the end of procedure1
and pass the vairables (parameters that were used in 1? and then again
from procedure 2 to 3?

Is there a a way to call them sequentially in Access from one form and
one command click?
here's my code from access:


I have three pass through queries set up in my Access database that
are processed on a MSSQL server. All three queries function properly
and process the data as expected. My problem is that the parameters
(FromDate and ToDate) are being entered via three different forms--one
form for each query. I would like for one form to execute all three
pass through queries. How can I make this work?



Here is my code: (basically the smae for each form with different
query identified)



Private Sub cmdRunqptRenewalRate_Click()

Dim db As DAO.Database
Dim strFromDate As String
Dim strToDate As String
Dim qd As DAO.QueryDef
Dim strSQL As String

' Ensure date-string inputs exist.
' NOTE: The code requires that both dates
' are supplied.

With Me!txtFromDate
If IsNull(.Value) Then
MsgBox "Please specify the first PaidThru date for the
report."
.SetFocus
Exit Sub
Else
strFromDate = Format(.Value, "YYYY-MM-DD")
End If
End With

With Me!txtToDate
If IsNull(.Value) Then
MsgBox "Please specify the last PaidThru date for the
report."
.SetFocus
Exit Sub
Else
strToDate = Format(.Value, "YYYY-MM-DD")
End If
End With

' Build the SQL query.
strSQL = _
"exec sp_NBAA_RenewRate '" & strFromDate & _
"','" & strToDate & "'"

Set db = CurrentDb()
Set qd = CurrentDb.QueryDefs("qry_update1_UD_Renewals")
qd.SQL = strSQL
qd.Connect =
"ODBC;DSN=IMIS_NBAA_Prod;Database=DB_name;Uid=XXX; Pwd=****;"
qd.ODBCTimeout = 300
qd.ReturnsRecords = False

DoCmd.OpenQuery "qry_update1_UD_Renewals"
'DoCmd.RunSQL strSQL
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:00 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com