473,505 Members | 15,626 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to refer to the RecordsetClone

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
3 2447
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6542
by: solar | last post by:
How to refer to a subform ? On my main form called FrmEmployees I have a button to open a report. I want to forbid opening the report in case the liters in the subform are 0. To this end I...
1
3244
by: Danke | last post by:
I have a for frmOrders with a subform frmOrderlines. How can i check if there is any record in the subform? Helge
13
2677
by: Seth Spearman | last post by:
Hey guys, I have the following code: '****************************************************** If Not Me.NewRecord Then Dim rs As DAO.Recordset Dim strBookmark As String Set rs =...
3
13917
by: Anthony Kroes | last post by:
I have a subform on a form and they are not linked. On the main form is a text box where the user types in a number. When that number changes, I have some code to make the corresponding text...
3
2591
by: Ian Bailey | last post by:
I have developed a routine that opens a number of forms with each form being positioned on a particular record. I am using the Recordsetclone to find the record and then setting the form bookmark...
22
4989
by: Br | last post by:
First issue: When using ADPs you no longer have the ability to issue a me.refresh to save the current record on a form (the me.refresh does a requery in an ADP). We usually do this before...
3
6161
by: G Gerard | last post by:
Hello Can I write an SQL statement in code using a RecordSetClone of an open form? something like: MySQL = "UPDATE Me!Child0.Form.RecordSetClone SET Me!Child0.Form.RecordSetClone.MyField =...
10
5754
by: d.francis | last post by:
I have converted an Access 97 database to Access 2003 The following code now fails and returns Run-time error '3420' Dim rst as DAO.recordset Set rst = Forms!frm1!frm2.Form.RecordsetClone I...
2
1947
imrosie
by: imrosie | last post by:
Hello, I have a search form that uses a row query to locate a customer by customerID and first & last names, so it's an unbound control. I also have two events associated with this control,...
0
7303
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7367
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7018
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5613
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4699
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1528
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
407
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.