473,386 Members | 1,654 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to retrieve actual recordset from a subform

759 512MB
Hello !
I have a form: frmMain. In this form a subform: frmSubform.
When I navigate in frmMain the records in frmSubform are changed adequately.
Well done !

Now, I wish to create a string by concatenate the records (from a certain field) from this subform.
Can I do that by using directly what I have (what I see) in the frmSubform for a certain record in frmMain ?
That means to access only the filtered records from the subform.

Thank you !
Apr 13 '12 #1

✓ answered by limweizhong

I think you might have the RecordsetClone property if you are using Access 2007. You can try that in place of the Recordset property...

Or you can Set Rst=Form_frmStatments_subform.Recordset.Clone().

Edit: OK, RecordsetClone is also available in previous versions of Access.

5 17092
Try using the child form's recordset, e.g. Child0.Form.RecordSet, but it might actually affect the record selector's position in the child form. Best way might be to do a separate query.

Edit: Yes it is really the displayed recordset in the form, so you might want to call Child0.Form.MoveFirst before and after your cycling through all the records.
Apr 13 '12 #2
Mihail
759 512MB
I have trying that and work OK (I can print in Immediate Window what I need) but, indeed, the record selector is affected in the child form.
So I think that I need to use a clone for this recordset. But I don't know how to obtain this clone.

Here is the current code I use:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdPreviewSketch_Click()
  2. Dim Rst As DAO.Recordset
  3. Set Rst = Form_frmStatments_subform.Recordset
  4.     Rst.MoveFirst
  5.     Do While Not Rst.EOF()
  6.         With Rst
  7.             Debug.Print !Statment 'Statment is the field name
  8.             .MoveNext
  9.         End With
  10.     Loop
  11. Exit Sub
Apr 13 '12 #3
Mihail
759 512MB
Solved somehow.
The subform must be requery after using it's recordset.
So, one more statement after line #10:
Expand|Select|Wrap|Line Numbers
  1. Form_frmStatments_subform.Requery
But I still think that using a clone is a better solution. Can this be achieved ?
Apr 13 '12 #4
I think you might have the RecordsetClone property if you are using Access 2007. You can try that in place of the Recordset property...

Or you can Set Rst=Form_frmStatments_subform.Recordset.Clone().

Edit: OK, RecordsetClone is also available in previous versions of Access.
Apr 13 '12 #5
Mihail
759 512MB
Yes !!!!!! That is. Thank you limweizhong !
As you I am looking for Subform.Recordset.Clone too but it is Subform.RecordsetClone. Uffff !
Expand|Select|Wrap|Line Numbers
  1. Dim Rst As DAO.Recordset
  2. Set Rst = Form_SubformName.RecordsetClone
  3.     Rst.MoveFirst
  4.     Do While Not Rst.EOF()
  5.         With Rst
  6.             'Do something
  7.             .MoveNext
  8.         End With
  9.     Loop
Apr 13 '12 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Thomas Scheiderich | last post by:
Why would you use the Recordset object over the Execute method of getting data from your Sql database. For example, I have the following: Execute Method...
1
by: PinkGuava | last post by:
Hi, I have a T-SQL stored procedure that returns both output parameters and a recordset. How do I retrieve them in my ASP script? As far as I know, the ADO Command object can be used to retrieve...
1
by: Robin Hammond | last post by:
Can anybody tell me why a) when running a stored proc from an asp page to return a recordset the command succeeds if the sp queries an existing table directly, but b) if the stored proc populates...
27
by: Oscar | last post by:
I am looking for a way to pass an ADO recordset that has been retrieved in an ASP page to another HTML-page. Is there someone who can provide me with a small sample or a link to see how this is...
3
by: tony wong | last post by:
The asp return the number of lastrecord from MsSQL server the returned number is 229 the last record number is 238 anything goes wrong? anything can assist me to troubleshoot?
0
by: Developer | last post by:
Hi, My C#, ASP.NET application uses com-interop to call a vb6 method which returns a ADO 2.6 recordset. I can successfully call the COM component and even retrieve the recordset. When I try to...
3
by: jd | last post by:
I am displaying a table and using javascript to provide an incremental search capability that allows certain rows to be dynamically hidden. The original table specifies no column widths, so I'm...
0
by: One from | last post by:
I have a lot of Oracle function in packages and i would like use it in my ASP pages. With Oracle procedure it's all right. Sample like this .... set cn = Server.CreateObject("ADODB.Connection")...
1
by: mark_aok | last post by:
Hi all, I have a form with a subform called "mySubForm" (the subform is always in datasheet view), and I have a button labeled "return item". When users click return item, it finds the record...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
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...

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.