Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 14th, 2003, 04:28 PM
abbakha abbakha is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 3 abbakha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Post Passing Parameters to Stored Procedure in MS Access

Hi
I am trying to pass date parameters from MS Access form to stored procedure on SQL server . When I execute the code I am getting an error on "qd.execute " The error message is

Number: 3065
Source : DAO.QueryDef
Text: Can not execute selected Query.


I am pasting the code here so If someone have any idea what would be the problem

Dim db As Database
Dim qd As QueryDef
Dim rs As Recordset
Dim fld As Field
Dim datStartDate, datEndDate As Date

'Getting the user inputs from Ms Access form
datStartDate = [Form_Archive Information].StartDate
datEndDate = [Form_Archive Information].EndDate
Set db = CurrentDb ' Setting the database as current Database
On Error Resume Next
db.QueryDefs.Delete ("GCS_PQ_ARCHIVED_RECORDS") 'deleting the old defination of pass-through query
On Error GoTo ErrorHandler
Set qd = db.CreateQueryDef("GCS_PQ_ARCHIVED_RECORDS") 'define new query defination
qd.ReturnsRecords = False ' Query do not retrieve records
'Connection string
'user id and password is deliberately hide before posting the code
qd.Connect = "ODBC;DSN=DSN_RACK_BARREL; UID=kabxxxx, PWD=xxxxx;DATABASE=RACKBARREL"
qd.SQL = "Exec GCS_SP_Archived_Records " & "'" & datStartDate & "'" & ", " & "'" & datEndDate & "'"
qd.Execute
qd.Close

ErrorHandler:
DisplayDAOError


Note: The reference libraries Microsoft ADO 3.6 reference library

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Passing Parameters to Stored Procedure in MS Access


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT