Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 27th, 2004, 12:30 PM
Registered User
 
Join Date: May 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Connecting VB Proj to a local Access DB

Hi,
I have been going around in circles on how to pass parameters to a select query in an access database from word using DAO. I keep getting a data type conversion error every time I run it. Maybe some one could help me.

Here is the SQL statement from my Access Query:
PARAMETERS [num] Text ( 255 );
SELECT tblTestingSummaryReport.[Date of Test], tblTestingSummaryReport.Index, tblTestingSummaryReport.[Study type]
FROM tblTestingSummaryReport
WHERE (((tblTestingSummaryReport.[SDC #])=[num]));


Here is the code from my VBA app:

   Dim MyWorkspace As Workspace
   Dim db As Database

   DBEngine.SystemDB = "System.mdw"
   Set MyWorkspace = DBEngine.CreateWorkspace ("Name", "DBAPaulD", pass)
    Set db = OpenDatabase("report.mdb", False, False)

   Dim rs As DAO.Recordset
   Dim qryDef As QueryDef

   Set qryDef = db.QueryDefs("qryRembrandtGetTSRIndex")
   qryDef.Parameters(0) = "13" 'This is text eventhough it is a number
   'This is where it crashes
   Set rs = qryDef.OpenRecordset("qryRembrandtGetTSRIndex")

Thanks







Similar Threads
Thread Thread Starter Forum Replies Last Post
Connecting to Access 20007 DB with vb.net JohnBoy VB.NET 1 May 21st, 2008 01:26 PM
Trouble connecting to Access DB thru IIS swoopest Classic ASP Databases 6 November 10th, 2004 10:13 AM
Connecting to Access via OLE-DB mairejo Access 3 October 26th, 2004 02:28 PM
Connecting to Access Db mattastic Classic ASP Databases 3 October 14th, 2004 02:32 AM
Connecting to another Access db with different IP ckentebe Access VBA 3 April 21st, 2004 12:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.