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 | 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 16th, 2009, 07:07 AM
Friend of Wrox
 
Join Date: Apr 2007
Location: , , .
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default Object Doesn't support property or method

Hi All

I am trying to get records froms stored procedure in access and link it with combobox but it gives error




Private Sub Form_Load()

'Dim r As New ADODB.Recordset

'r.CursorLocation = adUseClient

'Set r = CurrentProject.Connection.Execute("sp_CustomerSecu rityFilterTest")
'Set Me!Combobox.Recordset = r

Dim r As New ADODB.Recordset
Dim c As New ADODB.Command

c.ActiveConnection = SQLcon
c.CommandText = "sp_CustomerSecurityFilter"
c.CommandType = adCmdStoredProc
Set r = c.Execute

Set Me!SelectCustomer.RowSource = r


End Sub

Here's my stored procedure

ALTER PROCEDURE [dbo].[sp_CustomerSecurityFilterTest]

AS
-- Insert statements for procedure here
SELECT CID, Customer, CID, A1, APC,rep FROM Customers


Any suggestion or advice

Thanks

Ayaz
Reply With Quote
  #2 (permalink)  
Old October 16th, 2009, 09:08 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Generally to use a SELECT stored procedure, you would do this on the Access side:

Code:
'Open Connection
Set cn = New ADODB.Connection
cn.Open cString
 
'Create a new command object
Set cmdCommand = New ADODB.Command
cmdCommand.ActiveConnection = cn
 
'Specify the stored procedure to run
cmdCommand.CommandType = adCmdStoredProc
cmdCommand.CommandText = "usp_MySelectProcedure"
 
'Create the parameter if needed
Set prmRecID = cmdCommand.CreateParameter("@RecordID", adInteger, adParamInput)
prmRecID.Value = lRecordID 'Long
cmdCommand.Parameters.Append prmRecID
 
'Open recordset
Set rs = cmdCommand.Execute
Now you can use the recordset as you normally would.

On the server side, the stored procedure might look like:

Code:
USE [MyDatabaseName]
GO
ALTER procedure [dbo].[usp_MySelectProcedure]
  @RecordID   int
as 
 
SELECT CID, Customer, A1, APC,rep 
FROM Customers
WHERE CID = @RecordID
Did that help? Of course you wouldn't need the parameter.
__________________
mmcdonal

Look it up at: http://wrox.books24x7.com
Reply With Quote
  #3 (permalink)  
Old November 16th, 2009, 07:35 AM
Friend of Wrox
 
Join Date: Apr 2007
Location: , , .
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default

Hi donal

But I can't able to set Continous form Recordsource with recordobject

Regards

Ayaz
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
VB6, COM, Object doesn't support this property... thenoseknows Classic ASP Professional 1 July 12th, 2007 05:54 PM
error - Object doesn't support this property jamara VBScript 1 September 10th, 2006 05:13 AM
OBJECT DOESNT SUPPORT THIS PROPERTY OR METHOD KGANESH2006 Classic ASP Basics 4 March 24th, 2006 11:15 AM
Object doesn't support this property or method ASP crmpicco Classic ASP Components 0 March 16th, 2006 01:26 PM



All times are GMT -4. The time now is 10:45 PM.


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