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 September 16th, 2011, 08:54 AM
sh7 sh7 is offline
Registered User
 
Join Date: Sep 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default VBA Access 2007 SQL 2008 stored procedures

Hi,

have Access 2007 forms running on SQL server 2008. I am trying to get the following code I ahve seen in this forum running but now sure about the sql query syntax that is passed to the database. Looking at the sql profiler the execute command looks like:

execute sp_patient '111' ', ' ' xcc' ' ,.... (swl add too many quotes...)

Also If I want to return the result set to another form, how that can be done?


Private Sub Command0_Click()

Dim cnn As ADODB.Connection
Dim rstOut As ADODB.Recordset

Dim strPeriod As String
Dim strCountry As String
Dim strType As String

strPeriod = Me.cmb_period
strCountry = Me.cmb_country
strType = Me.cmb_Type
Set cmd = New ADODB.Command
With cmd
.ActiveConnection = CurrentProject.Connection
.CommandText = "EXEC SP_Patient " & " '" & strPeriod & "', '" & strType & "','" & strCountry & "'" .CommandType = adCmdText
.Execute
End With
End Sub

Many thanks in advance





Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling Stored Procedures from VBA Made Easy? dabrowne Access VBA 0 August 30th, 2010 04:06 PM
Access getting data via VBA from SQL Server 2008 jpl458 BOOK: Access 2003 VBA Programmer's Reference 0 September 25th, 2009 01:06 PM
Excel 2007 data from parameterized stored procedures scott.smith BOOK: Excel 2007 VBA Programmer's Reference ISBN: 978-0-470-04643-2 0 August 13th, 2009 11:17 AM
Access, SQL Server - Stored Procedures / DTS tcarnahan Access 5 September 1st, 2004 05:17 AM
stored procedures and MS Access madhukp Classic ASP Basics 5 August 26th, 2004 12:22 AM





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