473,396 Members | 2,011 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,396 software developers and data experts.

using once opened Record Set differently

553 512MB
I am opening record set at different places with different queries i.e:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Set rst = db.OpenRecordset("Select Names, Tasks, Datetime FROM tblUsers WHERE Users='" & strUName & "'" & "AND Tasks='" & strTask & "'")
  3.  
  4. Set rst = db.OpenRecordset("Select Tasks FROM tblUsers WHERE Users='" & strUName & "'" )
  5.  
I was wondering if it is possible or preferrable to open the record set only once and when i need to use the opened record set, i just query it as required - so i dont have to open record set all the times - avoiding doing same thing more than once ?
Aug 13 '07 #1
9 1758
Rabbit
12,516 Expert Mod 8TB
I am opening record set at different places with different queries i.e:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Set rst = db.OpenRecordset("Select Names, Tasks, Datetime FROM tblUsers WHERE Users='" & strUName & "'" & "AND Tasks='" & strTask & "'")
  3.  
  4. Set rst = db.OpenRecordset("Select Tasks FROM tblUsers WHERE Users='" & strUName & "'" )
  5.  
I was wondering if it is possible or preferrable to open the record set only once and when i need to use the opened record set, i just query it as required - so i dont have to open record set all the times - avoiding doing same thing more than once ?
What do you mean? Are you talking about in the same event but later on?

Using one record set and reopening what you need or using more than one record set; Both have their trade offs. Using one record set incurs computational time. Using more than one record set uses more RAM.

If you're asking my opinion, my computers have more than enough RAM to get along so I usually choose to use more than one record set.
Aug 13 '07 #2
questionit
553 512MB
Thats fine, but just for efficieny puposes, i would like to open the Record once and query it at different times - In the different Events.

So if i was to do like i have said, after opening the Record set , how would i do a complete query later as required ?

Note: I would open the Record Set in the Constructor : Class_Initialize()

Thanks


What do you mean? Are you talking about in the same event but later on?

Using one record set and reopening what you need or using more than one record set; Both have their trade offs. Using one record set incurs computational time. Using more than one record set uses more RAM.

If you're asking my opinion, my computers have more than enough RAM to get along so I usually choose to use more than one record set.
Aug 13 '07 #3
Rabbit
12,516 Expert Mod 8TB
Then use a global variable.
Aug 13 '07 #4
questionit
553 512MB
Rabbit,

after declaring it global and opening the record set once.

whats the method to query the recordset if required in any event?




Then use a global variable.
Aug 13 '07 #5
Rabbit
12,516 Expert Mod 8TB
Rabbit,

after declaring it global and opening the record set once.

whats the method to query the recordset if required in any event?
RecordsetVariable!FieldName
Aug 13 '07 #6
questionit
553 512MB
Rabbit,

ths way you get a value from a record set variable, right?

i meant to ask how you re-query a recordset once it is opened. When its is opened we execute a SQL query at that time but what if you need to change the SQL query and run onto the already opened RecordSet ?



RecordsetVariable!FieldName
Aug 14 '07 #7
questionit
553 512MB
Probably the concept of opening recordSet is different than what i had thought.

i think i dont need anymore posts on this.

but if someone could tell me if we can somehow pass a parameter to Class_Initialize() ? I have tried but not allowed - its a very useful feature in C/C++ , is there alternative of passing parameter to Class_Initialize() ?

Thanks

Rabbit,

ths way you get a value from a record set variable, right?

i meant to ask how you re-query a recordset once it is opened. When its is opened we execute a SQL query at that time but what if you need to change the SQL query and run onto the already opened RecordSet ?
Aug 14 '07 #8
Rabbit
12,516 Expert Mod 8TB
Probably the concept of opening recordSet is different than what i had thought.

i think i dont need anymore posts on this.

but if someone could tell me if we can somehow pass a parameter to Class_Initialize() ? I have tried but not allowed - its a very useful feature in C/C++ , is there alternative of passing parameter to Class_Initialize() ?

Thanks
I have no idea what you mean by Class_Initialize. What are you trying to do? If we know what you're trying to do then we can help.
Aug 14 '07 #9
JKing
1,206 Expert 1GB
Class_Initialize and Class_Terminate act as constructors and destructors for classes. Unfortunately they do not support parameters. I don't believe VBA was intended to be used for full out object oriented based programming and there for doesn't support overloading constructors.

Here's a link to a previous thread that discusses this matter
http://www.thescripts.com/forum/thread206362.html
Aug 14 '07 #10

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

Similar topics

121
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
3
by: google | last post by:
I'm developing an application for use within my company in Access 2003. I'm new to '03, the application I did for my former employer was in '97. The two applications have similar functionality...
4
by: Rico | last post by:
Hello, I'm looking for a way to force a pagebreak in code. I'm having a tough time, the first page formats properly until the condition is met and then forces a new page. The problem is, every...
8
by: Craig | last post by:
Hi there, I'm only new to Python so please bear with me. I using ElementTree to generate an XML file that will reference a DTD and an XSL file. The header information I want at the start of...
14
by: keri | last post by:
Hi, Simple version of the question..... How do I use the where clause of the open form command to show an account with a matching ID to be displayed when the form is opened? Eg. I select a...
2
by: toddw607 | last post by:
Hi Everyone! I have a ASP.NET webform that brings data in from SQL Server 2000 and displays it on a page. I want to update the webpage while in IE using the following code: <%@ Import...
71
by: desktop | last post by:
I have read in Bjarne Stroustrup that using malloc and free should be avoided in C++ because they deal with uninitialized memory and one should instead use new and delete. But why is that a...
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
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:
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...
0
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
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
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,...

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.