Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old September 16th, 2011, 08:54 AM
sh7 sh7 is offline
Registered User
Points: 13, Level: 1
Points: 13, Level: 1 Points: 13, Level: 1 Points: 13, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Sep 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default VBA Access 2007 SQL 2008 stored procedures


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
End With
End Sub

Many thanks in advance
Reply With Quote

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 04:56 AM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.