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

Continuous Forms with an Oracle ADO recordset

I have code as follows:

Expand|Select|Wrap|Line Numbers
  1. Dim conn As New ADODB.Connection
  2. Dim rst As New ADODB.Recordset
  3.  
  4. conn.ConnectionString = "Provider=MSDAORA;Password=tr7025ds;User ID=system;Data Source=WIN10"
  5. conn.Open
  6.  
  7. rst.Open "select sid, serial#, username, program, machine, status from v$session where serial#<>1 order by status", conn
  8.  
  9. Do Until rst.EOF
  10.   For i = 0 To rst.Fields.Count - 1
  11.      --this is where I need help!
  12.   Next
  13.   rst.MoveNext
  14. Loop
  15.  
  16. rst.Close
  17. conn.Close
In the middle of that loop I've had this sort of thing:

Expand|Select|Wrap|Line Numbers
  1. Me!Text1 = rst!sid
  2. Me!Text3 = rst![serial#]
...and so on.

That works nicely... provided I only want to see one record! It's always the last record, too, because the MoveNext neatly traverses its way through the entire recordset, of course.

What I can't work out is how to display all records on a Continuous Forms basis. I've tried this:

Expand|Select|Wrap|Line Numbers
  1. Me!Text1.ControlSource = rst!sid
...but that just makes the control display '#Name?', which made me think the problem was the form is unbound to any record source. So then I tried:

Expand|Select|Wrap|Line Numbers
  1. Me.RecordSource = rst
...outside the loop, with the ControlSource setting inside. But that merely produces a 'type mismatch' error. And I also tried setting Me.RecordSET =rst, but that causes an 'Object variable or With block variable not set' error.

I'd appreciate any guidance on this anyone can offer!

It is possible that continuous forms would not be the most appropriate way of displaying this information anyway, so if someone could also explain how to set a list control to display all the records in my recordset, I'd be very grateful!
Aug 31 '07 #1
5 3458
JConsulting
603 Expert 512MB
I have code as follows:

Expand|Select|Wrap|Line Numbers
  1. Dim conn As New ADODB.Connection
  2. Dim rst As New ADODB.Recordset
  3.  
  4. conn.ConnectionString = "Provider=MSDAORA;Password=tr7025ds;User ID=system;Data Source=WIN10"
  5. conn.Open
  6.  
  7. rst.Open "select sid, serial#, username, program, machine, status from v$session where serial#<>1 order by status", conn
  8.  
  9. Do Until rst.EOF
  10.   For i = 0 To rst.Fields.Count - 1
  11.      --this is where I need help!
  12.   Next
  13.   rst.MoveNext
  14. Loop
  15.  
  16. rst.Close
  17. conn.Close
In the middle of that loop I've had this sort of thing:

Expand|Select|Wrap|Line Numbers
  1. Me!Text1 = rst!sid
  2. Me!Text3 = rst![serial#]
...and so on.

That works nicely... provided I only want to see one record! It's always the last record, too, because the MoveNext neatly traverses its way through the entire recordset, of course.

What I can't work out is how to display all records on a Continuous Forms basis. I've tried this:

Expand|Select|Wrap|Line Numbers
  1. Me!Text1.ControlSource = rst!sid
...but that just makes the control display '#Name?', which made me think the problem was the form is unbound to any record source. So then I tried:

Expand|Select|Wrap|Line Numbers
  1. Me.RecordSource = rst
...outside the loop, with the ControlSource setting inside. But that merely produces a 'type mismatch' error. And I also tried setting Me.RecordSET =rst, but that causes an 'Object variable or With block variable not set' error.

I'd appreciate any guidance on this anyone can offer!

It is possible that continuous forms would not be the most appropriate way of displaying this information anyway, so if someone could also explain how to set a list control to display all the records in my recordset, I'd be very grateful!
I believe you need to just set the form's recordsource

me.recordsource = rst

Looping through controls will only update the fields in the first record.

And I believe you'll need to add a dynaset option or cursor location. But Oracle isn't my specialty.
J
Aug 31 '07 #2
Jim Doherty
897 Expert 512MB
I have code as follows:

Expand|Select|Wrap|Line Numbers
  1. Dim conn As New ADODB.Connection
  2. Dim rst As New ADODB.Recordset
  3.  
  4. conn.ConnectionString = "Provider=MSDAORA;Password=tr7025ds;User ID=system;Data Source=WIN10"
  5. conn.Open
  6.  
  7. rst.Open "select sid, serial#, username, program, machine, status from v$session where serial#<>1 order by status", conn
  8.  
  9. Do Until rst.EOF
  10.   For i = 0 To rst.Fields.Count - 1
  11.      --this is where I need help!
  12.   Next
  13.   rst.MoveNext
  14. Loop
  15.  
  16. rst.Close
  17. conn.Close
In the middle of that loop I've had this sort of thing:

Expand|Select|Wrap|Line Numbers
  1. Me!Text1 = rst!sid
  2. Me!Text3 = rst![serial#]
...and so on.

That works nicely... provided I only want to see one record! It's always the last record, too, because the MoveNext neatly traverses its way through the entire recordset, of course.

What I can't work out is how to display all records on a Continuous Forms basis. I've tried this:

Expand|Select|Wrap|Line Numbers
  1. Me!Text1.ControlSource = rst!sid
...but that just makes the control display '#Name?', which made me think the problem was the form is unbound to any record source. So then I tried:

Expand|Select|Wrap|Line Numbers
  1. Me.RecordSource = rst
...outside the loop, with the ControlSource setting inside. But that merely produces a 'type mismatch' error. And I also tried setting Me.RecordSET =rst, but that causes an 'Object variable or With block variable not set' error.

I'd appreciate any guidance on this anyone can offer!

It is possible that continuous forms would not be the most appropriate way of displaying this information anyway, so if someone could also explain how to set a list control to display all the records in my recordset, I'd be very grateful!

If you specifically desire continous form viewing have you considered early binding using linked table ODBC using oracle driver?. Controlling your rst by late binding yourself you lose that functionality..File...Get External Data... Linked Tables.

Jim

Jim
Aug 31 '07 #3
ADezii
8,834 Expert 8TB
I have code as follows:

Expand|Select|Wrap|Line Numbers
  1. Dim conn As New ADODB.Connection
  2. Dim rst As New ADODB.Recordset
  3.  
  4. conn.ConnectionString = "Provider=MSDAORA;Password=tr7025ds;User ID=system;Data Source=WIN10"
  5. conn.Open
  6.  
  7. rst.Open "select sid, serial#, username, program, machine, status from v$session where serial#<>1 order by status", conn
  8.  
  9. Do Until rst.EOF
  10.   For i = 0 To rst.Fields.Count - 1
  11.      --this is where I need help!
  12.   Next
  13.   rst.MoveNext
  14. Loop
  15.  
  16. rst.Close
  17. conn.Close
In the middle of that loop I've had this sort of thing:

Expand|Select|Wrap|Line Numbers
  1. Me!Text1 = rst!sid
  2. Me!Text3 = rst![serial#]
...and so on.

That works nicely... provided I only want to see one record! It's always the last record, too, because the MoveNext neatly traverses its way through the entire recordset, of course.

What I can't work out is how to display all records on a Continuous Forms basis. I've tried this:

Expand|Select|Wrap|Line Numbers
  1. Me!Text1.ControlSource = rst!sid
...but that just makes the control display '#Name?', which made me think the problem was the form is unbound to any record source. So then I tried:

Expand|Select|Wrap|Line Numbers
  1. Me.RecordSource = rst
...outside the loop, with the ControlSource setting inside. But that merely produces a 'type mismatch' error. And I also tried setting Me.RecordSET =rst, but that causes an 'Object variable or With block variable not set' error.

I'd appreciate any guidance on this anyone can offer!

It is possible that continuous forms would not be the most appropriate way of displaying this information anyway, so if someone could also explain how to set a list control to display all the records in my recordset, I'd be very grateful!
  1. Declare a Global Variable to reference your Open Recordset.
  2. Open your Form Hidden.
  3. Set the Form's Recordset Property to the Open Recordset which you created.
  4. Make the Form Visible.
  5. When finished with the Form, Close the Recordset and release its Object Variable Reference (Set rst = Nothing).
  6. I do believe that JConsulting is correct in that your Recordset may be Forward Only/Read Only.
  7. You may have to set the Cursor Location to adUseClient and the Cursor Type to adOpenKeyset.
  8. I'm like JConsulting in that I'm not an Oracle expert, so you must experiment should your Form be Read Only.
  9. You should be able to accomplish what you have requested with the information that I have given you.
  10. Good Luck.
Sep 1 '07 #4
I believe you need to just set the form's recordsource

me.recordsource = rst

Looping through controls will only update the fields in the first record.

And I believe you'll need to add a dynaset option or cursor location. But Oracle isn't my specialty.
J
Thanks, but I did mention that I'd already tried that and that it produced an error.
Sep 1 '07 #5
  1. Declare a Global Variable to reference your Open Recordset.
  2. Open your Form Hidden.
  3. Set the Form's Recordset Property to the Open Recordset which you created.
  4. Make the Form Visible.
  5. When finished with the Form, Close the Recordset and release its Object Variable Reference (Set rst = Nothing).
  6. I do believe that JConsulting is correct in that your Recordset may be Forward Only/Read Only.
  7. You may have to set the Cursor Location to adUseClient and the Cursor Type to adOpenKeyset.
  8. I'm like JConsulting in that I'm not an Oracle expert, so you must experiment should your Form be Read Only.
  9. You should be able to accomplish what you have requested with the information that I have given you.
  10. Good Luck.
Phew! Thanks for all that. I frankly didn't understand most of it, I'm afraid. I do Oracle for a living, not VBA!

This is what I came up with and which works quite nicely for my purposes:

Expand|Select|Wrap|Line Numbers
  1. Dim db As Database
  2. Dim conn As New ADODB.Connection
  3. Dim qdf As QueryDef
  4. Dim rst As Recordset
  5.  
  6. conn.ConnectionString = "Provider=MSDAORA;Password=tr7025ds;User ID=system;Data Source=WIN10"
  7.  
  8. Set qdf = CurrentDb.CreateQueryDef("")
  9. qdf.Connect = "ODBC;DSN=WIN10;UID=SYSTEM;PWD=tr7025ds"
  10. qdf.SQL = "select sid, serial#, username, program, machine, status from v$session where serial#<>1 order by status"
  11. qdf.ReturnsRecords = True
  12. Set rst = qdf.OpenRecordset
  13.  
  14. Me!Sessions.RowSource = ""
  15.  
  16. Do Until rst.EOF
  17.   For i = 0 To rst.Fields.Count - 1
  18.      Me!Sessions.RowSource = Me!Sessions.RowSource & rst.Fields(i) & ";"
  19.   Next
  20.   rst.MoveNext
  21. Loop
  22.  
It's probably horrible from a professional perspective, but it gets the job done for a list box (called 'Sessions') that allows me to select the records I'm interested in and then to start drilling down into more detail on other forms.

I appreciate the assistance offered, however.
Sep 1 '07 #6

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

Similar topics

2
by: aaj | last post by:
Hi all I have a small but rather annoying problem with continuos forms, and am wondering if anyone can suggest a method of getting over it. The front end is Access 2002 with the BE being SQL...
5
by: Armando | last post by:
I recently saw the tail end of a "Continuous forms" discussion, but not enough was available to see if this will be a PITA repeat question. Sorry if it is. On a form with its Default View...
3
by: Richard Hollenbeck | last post by:
I have the following query in my form's code: Private Function Get_Data(fieldNum As Integer) Dim strSQL As String Dim db As DAO.Database Dim rs As DAO.Recordset strSQL = "SELECT & "", "" & ...
3
by: Leo | last post by:
Hi everybody, Is there a way to fill a continuous form with an ADO recordset? Normally when I populate the form with the recordset only the first record is shown. I want to fill all records....
0
by: MSK | last post by:
Hi, I would like to generate a report for a specific record from a continuous form Env: MS Access 2003 , ADP project , ADO , SQL server 2000 Workflow: 1. Constructed a recordset using...
10
by: webgirl | last post by:
Hi there, I've been searching the net & the forums here over the last few days for help with my problem & am getting myself really confused.. hoping someone may be able to help me here. I've...
1
by: blueheelers | last post by:
I have been researching for several hours on the best way to display images in continous forms in Access 2003. For example, I want to display employee name, email, phone, and picture for each...
6
by: Greg Strong | last post by:
Hello All, Is is possible to use an ADO recordset to populate an unbound continuous Subform? I've done some Googling without much luck, so this maybe impossible, but let me try to explain...
6
by: TurnerTech | last post by:
Hi guys. I am struggling with this and I need it to complete a fairly cool facility for the users. I have a continuous form which is populated by a recordset generated by a "common" routine...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...

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.