Wrox Programmer Forums
|
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 November 16th, 2009, 07:29 AM
Friend of Wrox
 
Join Date: Apr 2007
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default Form Record Source

Hi
I am using this this to fill up my continous form with different text field in it

Dim cmd As New ADODB.Command
Dim prm As ADODB.Parameter
Dim r As New ADODB.Recordset

cmd.ActiveConnection = SQLcon
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "sp_Order"

Set prm = cmd.CreateParameter("@SDATE", adDBTimeStamp, adParamInput)
cmd.Parameters.Append prm
cmd.Parameters("@SDATE").Value = Format(Me!DateSearch, "yyyy/mm/dd hh:mm:ss")

Set prm = cmd.CreateParameter("@CUSER", adInteger, adParamInput)
cmd.Parameters.Append prm
cmd.Parameters("@CUSER").Value = CUser()
Set r = cmd.Execute()

'THIS LINE GIVE ERROR
'Set Me.Recordset = r


'THIS CODE BELOW ABLE TO PRING VALUES IN DEBUG SCREEN
While Not r.EOF
Debug.Print r!Rep & " , " & r!MID & " , " & r!TDate & " , " & r!Value & " , " & r!SDATE & " , " & r!ElecOrMach
r.MoveNext
Wend

any idea

Regards

Ayaz
 
Old November 16th, 2009, 08:17 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Hi...

What error?
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
 
Old November 16th, 2009, 11:01 AM
Friend of Wrox
 
Join Date: Apr 2007
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default

Hi

Thanks for your reply

Run-time error '7965'

The object you entered is not a valid recordset property

then i change it to

Set me.recordsource = r

Compile error
Invalid use of propert

I can't even do something like

me.txtfield = r!value2

Regards

Ayaz





Similar Threads
Thread Thread Starter Forum Replies Last Post
SOLVED - VBA Help For Row Source and Record Source eusanpe Access VBA 4 May 13th, 2008 11:58 AM
Update Source Record After Insert Duncan Allen SQL Server DTS 1 October 25th, 2004 10:44 AM
Record source ... does not exist tunsted Access 2 April 1st, 2004 10:03 AM
Report's record source too long Mitch Access 7 January 26th, 2004 04:17 PM
record source damnnono_86 Access 6 November 10th, 2003 10:32 PM





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