By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,516 Members | 1,137 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,516 IT Pros & Developers. It's quick & easy.

How to refer to the RecordsetClone

P: n/a
Hello

I am trying to refer in code to the RecordsetClone of a subform datasheet
but I'm getting syntax errors.

This is what I am writing:

Set MyDB = DBEngine.Workspaces(0).Databases(0)
MySQL = "SELECT Sum([Qty]*[Cost]) AS Expr1 FROM
Forms!Form1!Child0.Form.RecordsetClone;"
Set MySet = MyDB.OpenRecordset (MySQL, DB_OPEN_DYNASET)
Me!SumTextBox = MySet!Expr1
MySet.Cose

The errors ar caused be the way I am refering to
Forms!Form1!Child0.Form.RecordsetClone in setting MySQL

How should I write the code so MySQL can look at the records in the
Forms!Form1!Child0 datasheet and calcluate the sum of the [Qty]*[Cost]

I am using Access 2000
Thanks
G.Gerard
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Sat, 04 Dec 2004 20:04:51 GMT, "GGerard" <gg*****@nbnet.nb.ca>
wrote:

Seems like you're taking the long way home. I would set
SumTextBox.ControlSource to:
=Child0.Form!Qty * Child0.Form!Cost

-Tom.

Hello

I am trying to refer in code to the RecordsetClone of a subform datasheet
but I'm getting syntax errors.

This is what I am writing:

Set MyDB = DBEngine.Workspaces(0).Databases(0)
MySQL = "SELECT Sum([Qty]*[Cost]) AS Expr1 FROM
Forms!Form1!Child0.Form.RecordsetClone;"
Set MySet = MyDB.OpenRecordset (MySQL, DB_OPEN_DYNASET)
Me!SumTextBox = MySet!Expr1
MySet.Cose

The errors ar caused be the way I am refering to
Forms!Form1!Child0.Form.RecordsetClone in setting MySQL

How should I write the code so MySQL can look at the records in the
Forms!Form1!Child0 datasheet and calcluate the sum of the [Qty]*[Cost]

I am using Access 2000
Thanks
G.Gerard


Nov 13 '05 #2

P: n/a
GGerard wrote:
Hello

I am trying to refer in code to the RecordsetClone of a subform datasheet
but I'm getting syntax errors.

This is what I am writing:

Set MyDB = DBEngine.Workspaces(0).Databases(0)
MySQL = "SELECT Sum([Qty]*[Cost]) AS Expr1 FROM
Forms!Form1!Child0.Form.RecordsetClone;"
Set MySet = MyDB.OpenRecordset (MySQL, DB_OPEN_DYNASET)
Me!SumTextBox = MySet!Expr1
MySet.Cose

The errors ar caused be the way I am refering to
Forms!Form1!Child0.Form.RecordsetClone in setting MySQL

How should I write the code so MySQL can look at the records in the
Forms!Form1!Child0 datasheet and calcluate the sum of the [Qty]*[Cost]


Set MySet = Forms!Form1!Child0.Form.RecordsetClone

--
This sig left intentionally blank
Nov 13 '05 #3

P: n/a
Trevor Best <no****@besty.org.uk> wrote in
news:41**********************@news.zen.co.uk:
GGerard wrote:
Hello

I am trying to refer in code to the RecordsetClone of a subform
datasheet but I'm getting syntax errors.

This is what I am writing:

Set MyDB = DBEngine.Workspaces(0).Databases(0)
MySQL = "SELECT Sum([Qty]*[Cost]) AS Expr1 FROM
Forms!Form1!Child0.Form.RecordsetClone;"
Set MySet = MyDB.OpenRecordset (MySQL, DB_OPEN_DYNASET)
Me!SumTextBox = MySet!Expr1
MySet.Cose

The errors ar caused be the way I am refering to
Forms!Form1!Child0.Form.RecordsetClone in setting MySQL

How should I write the code so MySQL can look at the records in
the Forms!Form1!Child0 datasheet and calcluate the sum of the
[Qty]*[Cost]


Set MySet = Forms!Form1!Child0.Form.RecordsetClone


Well, for me, I think it's much, much easier to *not* set an object
variable and use a WITH:

With Forms!Form1!Child0.Form.RecordsetClone
Me!SumTextBox = !Expr1
End With

That way, you don't have to set clean up the object variable after
using.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.