I am opening record set at different places with different queries i.e: -
-
Set rst = db.OpenRecordset("Select Names, Tasks, Datetime FROM tblUsers WHERE Users='" & strUName & "'" & "AND Tasks='" & strTask & "'")
-
-
Set rst = db.OpenRecordset("Select Tasks FROM tblUsers WHERE Users='" & strUName & "'" )
-
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 ?
9 1758
I am opening record set at different places with different queries i.e: -
-
Set rst = db.OpenRecordset("Select Names, Tasks, Datetime FROM tblUsers WHERE Users='" & strUName & "'" & "AND Tasks='" & strTask & "'")
-
-
Set rst = db.OpenRecordset("Select Tasks FROM tblUsers WHERE Users='" & strUName & "'" )
-
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.
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.
Then use a global variable.
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.
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
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
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 ?
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.
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 Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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: 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...
|
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...
|
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,...
| |