|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > Passing Parameters to Stored Procedure in MS Access |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|