473,387 Members | 1,569 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,387 software developers and data experts.

bind a standalone recordset to a form

Hello All,

I am looking to whip a recordset out of thin air through a series of
database record manipulation (so there is no physical equivalence to
any database entities such as a table or compounded query) and then
bind that standalone recordset to a form to display the result of such
operations.

I could seem to find a good way of doing it, as I try to change the
recordsource property of the form with no success.

So here is what I have got,

Private Sub Form_Open(Cancel As Integer)
Dim rsRecSet As New ADODB.Recordset
rsRecSet.Fields.Append "Account ID", adVarChar, 20
rsRecSet.Fields.Append "Num1", adInteger
rsRecSet.Fields.Append "Num2", adInteger
rsRecSet.Open
rsRecSet.AddNew
rsRecSet("Account ID") = "ABCDEFG"
rsRecSet("Num1") = 99
rsRecSet("Num2") = 99
rsRecSet.Update
RecordSource = "rsRecSet"
End Sub

so it doesn't seem to work - is there actually anyway to do this
(besides actually create a table then write the recrodset into the
table and then read off the table)?

thank you so much for your assistance!
Nov 13 '05 #1
5 3557
I think you can search the archives of this newsgroup at
http://groups.google.com and find an extensive discussion of this subject. I
found that discussion very informative, though I never had occasion to use
it in paying work.

Larry Linson
Microsoft Access MVP

"Henry Su" <su******@gmail.com> wrote in message
news:53**************************@posting.google.c om...
Hello All,

I am looking to whip a recordset out of thin air through a series of
database record manipulation (so there is no physical equivalence to
any database entities such as a table or compounded query) and then
bind that standalone recordset to a form to display the result of such
operations.

I could seem to find a good way of doing it, as I try to change the
recordsource property of the form with no success.

So here is what I have got,

Private Sub Form_Open(Cancel As Integer)
Dim rsRecSet As New ADODB.Recordset
rsRecSet.Fields.Append "Account ID", adVarChar, 20
rsRecSet.Fields.Append "Num1", adInteger
rsRecSet.Fields.Append "Num2", adInteger
rsRecSet.Open
rsRecSet.AddNew
rsRecSet("Account ID") = "ABCDEFG"
rsRecSet("Num1") = 99
rsRecSet("Num2") = 99
rsRecSet.Update
RecordSource = "rsRecSet"
End Sub

so it doesn't seem to work - is there actually anyway to do this
(besides actually create a table then write the recrodset into the
table and then read off the table)?

thank you so much for your assistance!

Nov 13 '05 #2
Hello Larry,

Thanks for your pointer. Believe you me, I have tried many searches
and yielded very poor results - I think it might be due to I'm not
using the common semantic for these terms.

Are there specific search terms that you could tell me to research by?

Thanks,
Henry
"Larry Linson" <bo*****@localhost.not> wrote in message news:<5FSXc.228$Gr2.122@trnddc07>...
I think you can search the archives of this newsgroup at
http://groups.google.com and find an extensive discussion of this subject. I
found that discussion very informative, though I never had occasion to use
it in paying work.

Larry Linson
Microsoft Access MVP

"Henry Su" <su******@gmail.com> wrote in message
news:53**************************@posting.google.c om...
Hello All,

I am looking to whip a recordset out of thin air through a series of
database record manipulation (so there is no physical equivalence to
any database entities such as a table or compounded query) and then
bind that standalone recordset to a form to display the result of such
operations.

I could seem to find a good way of doing it, as I try to change the
recordsource property of the form with no success.

So here is what I have got,

Private Sub Form_Open(Cancel As Integer)
Dim rsRecSet As New ADODB.Recordset
rsRecSet.Fields.Append "Account ID", adVarChar, 20
rsRecSet.Fields.Append "Num1", adInteger
rsRecSet.Fields.Append "Num2", adInteger
rsRecSet.Open
rsRecSet.AddNew
rsRecSet("Account ID") = "ABCDEFG"
rsRecSet("Num1") = 99
rsRecSet("Num2") = 99
rsRecSet.Update
RecordSource = "rsRecSet"
End Sub

so it doesn't seem to work - is there actually anyway to do this
(besides actually create a table then write the recrodset into the
table and then read off the table)?

thank you so much for your assistance!

Nov 13 '05 #3
"Disconnected recordset" is the term for an ADP.

While you can open a recordset in an MDB, you can't "disconnect" it, so it
would be no use to use that as the RecordSource of a Form or Report -- you
are just as well off to use the SQL or Query that you'd use to open the
Recordset as the RecordSource.

And, IMNSHO, that is also often best in an ADP. There are some situations in
which using a "disconnected recordset" is useful, but the technique can be
problematic, too. What happens if multiple users, each using a disconnected
recordset, are updating the same data and then they all try to "batch
update" the underlying tables?

Larry Linson
Microsoft Access MVP

"Henry Su" <su******@gmail.com> wrote in message
news:53**************************@posting.google.c om...
Hello Larry,

Thanks for your pointer. Believe you me, I have tried many searches
and yielded very poor results - I think it might be due to I'm not
using the common semantic for these terms.

Are there specific search terms that you could tell me to research by?

Thanks,
Henry
"Larry Linson" <bo*****@localhost.not> wrote in message

news:<5FSXc.228$Gr2.122@trnddc07>...
I think you can search the archives of this newsgroup at
http://groups.google.com and find an extensive discussion of this subject. I found that discussion very informative, though I never had occasion to use it in paying work.

Larry Linson
Microsoft Access MVP

"Henry Su" <su******@gmail.com> wrote in message
news:53**************************@posting.google.c om...
Hello All,

I am looking to whip a recordset out of thin air through a series of
database record manipulation (so there is no physical equivalence to
any database entities such as a table or compounded query) and then
bind that standalone recordset to a form to display the result of such
operations.

I could seem to find a good way of doing it, as I try to change the
recordsource property of the form with no success.

So here is what I have got,

Private Sub Form_Open(Cancel As Integer)
Dim rsRecSet As New ADODB.Recordset
rsRecSet.Fields.Append "Account ID", adVarChar, 20
rsRecSet.Fields.Append "Num1", adInteger
rsRecSet.Fields.Append "Num2", adInteger
rsRecSet.Open
rsRecSet.AddNew
rsRecSet("Account ID") = "ABCDEFG"
rsRecSet("Num1") = 99
rsRecSet("Num2") = 99
rsRecSet.Update
RecordSource = "rsRecSet"
End Sub

so it doesn't seem to work - is there actually anyway to do this
(besides actually create a table then write the recrodset into the
table and then read off the table)?

thank you so much for your assistance!

Nov 13 '05 #4
On 27 Aug 2004 14:17:57 -0700, su******@gmail.com (Henry Su) wrote:
Hello All,

I am looking to whip a recordset out of thin air through a series of
database record manipulation (so there is no physical equivalence to
any database entities such as a table or compounded query) and then
bind that standalone recordset to a form to display the result of such
operations.

....

Hi
One way you can use a set of expressions as a bindable recordsource is
to link to some grounded table. What follows is from a post I made in
1998.

The idea is to have just one table, of numbers only, which must be big
enough. I used a table called "integers" with one primary key field
called "I" of type long. (SQL integer!) In the examples I assume this
runs from 0 to 9999. Now you can simulate virtual tables with queries,
provided you can associate an integer with each of your calculated
expressions. For example

VTableDates:
SELECT DISTINCTROW DateAdd("d",[i],CVDate("1 January 1990")) AS
DateValue, Integers.i
FROM Integers
ORDER BY Integers.i;

You can create the table "integers" by running:

Public Function VSetup()
Dim rs As Recordset
Dim j As Long
Dim db As DATABASE
On Error Resume Next ' (!)
Set db = DBEngine(0)(0)
db.Execute "CREATE TABLE integers (i INTEGER );"
Set rs = db.OpenRecordset("integers", dbOpenTable)
DBEngine(0).BeginTrans
For j = 0 To 9999
rs.AddNew
rs!i = j
rs.UPDATE
Next j
DBEngine(0).CommitTrans
rs.Close
db.Execute "CREATE INDEX PrimaryKey ON integers (i) WITH PRIMARY;"
End Function

David Schofield
Nov 13 '05 #5
On Aug 27 2004, 05:17 pm, su******@gmail.com (Henry Su) wrote in
news:53**************************@posting.google.c om:
I am looking to whip a recordset out of thin air through a series of
database record manipulation (so there is no physical equivalence to
any database entities such as a table or compounded query) and then
bind that standalone recordset to a form to display the result of such
operations.

I could seem to find a good way of doing it, as I try to change the
recordsource property of the form with no success.


You need to set the Recordset property, not RecordSource, and this is only
possible in A2000 and later. See this post for more details:

http://www.google.com/groups?as_umsg...3u03b9gvb72b@4
ax.com

--
remove a 9 to reply by email
Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: dmiller23462 | last post by:
My brain is nuked....Can anybody tell me right off the bat what is wrong with this code? Along with any glaring errors, please let me know the syntax to display a message (Response.Write would be...
2
by: Lyn | last post by:
If I have a form where the RecordSource property is set to the name of a table, then on opening the SingleForm form I can cycle through all the records in the table one at a time via Next and...
5
by: Mark | last post by:
Can I bind datagrid to an xml string (not to file)? For example, the result of transformation?
6
by: Oscar N. Goyee | last post by:
Well, its sames difficult for me; I love access so much and wish to make it perform extra task. I prepared an HTML form but can not connect it to my access table and so I think it is possible to...
1
by: mike11d11 | last post by:
Can anyone Tell me why this code doesnt let me bind a Textbox field to the Account# column in my SQL table. It says "Cannot bind to the property or column ACCOUNT# on the DataSource. Parameter...
2
by: hackmagic | last post by:
Hi, i have a form that normally has a Recordset containing only one record bound to it. i have replaced the navigation buttons with my own and the 'New Record' button assigns an empty Recordset...
1
by: adolph | last post by:
I wrote an access2000 database for a POS system. In it is a sales form with a a subform showing the items being purchased. The main form is unbound. It uses a class to hold the main form data...
2
by: wallconor | last post by:
Hi, I am having a problem using Dreamweaver CS3 standard recordset paging behavior. It doesn’t seem to work when I pass parameter values from a FORM on my search page, to the recordset on my...
5
by: Jacopo | last post by:
Dear guys, I am having problems minimizing and restoring forms. I am using Access 2003 on WXP. In my DB I am using just unbound forms. The typical form has a main area with controls to edit new...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.