473,507 Members | 2,374 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VBA versus Query

Hello,

I have hit the "Cannot open any more databases" and "System resource
exceeded" errors. Knew this was coming, but as I got closer to finishing the
database, I hoped it wouldn't be an issue.

My DB consists of hundreds of unique pieces of information (in atomic tables
of course). However, I have many multiple queries that are required to
compile information and conduct various calculations to put it in a workable
format for reports and forms.

My posed question:

1) Should I have the "queries" execute on the forms/reports themselves using
VB code or
2) Should I rework my database design to improve effeciency

Right now a particular form may refer to a query that refers to multiple
queries and tables.

Thanks for your help!

B

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200708/1

Aug 15 '07 #1
12 2089
bhipwell via AccessMonster.com wrote:
Hello,

I have hit the "Cannot open any more databases" and "System resource
exceeded" errors. Knew this was coming, but as I got closer to finishing the
database, I hoped it wouldn't be an issue.

My DB consists of hundreds of unique pieces of information (in atomic tables
of course). However, I have many multiple queries that are required to
compile information and conduct various calculations to put it in a workable
format for reports and forms.

My posed question:

1) Should I have the "queries" execute on the forms/reports themselves using
VB code or
2) Should I rework my database design to improve effeciency

Right now a particular form may refer to a query that refers to multiple
queries and tables.

Thanks for your help!

B
You can have 32,768 objects in a A97 database. You can have 1024 open
tables open at a time. (Go to help, type Specifications)

Are you opening connections to a database
set dbs = Currentdb
or recordsets
set rst = dbs.Openrecordset
and not closing them or setting the object to nothing?
Aug 15 '07 #2
Where I am stuck right now is with a query. If I right click on it and
select design, I get "System resource exceeded." I can get it in datasheet
view and SQL, however. It is a messy query that uses other queries so I can
populate a report. (A2000)

Untangling this could be a mess. I was think I may just have the report make
queries for itself.

Any thoughts?

B

--
Message posted via http://www.accessmonster.com

Aug 15 '07 #3
Ben
On Aug 15, 8:31 am, "bhipwell via AccessMonster.com" <u30281@uwe>
wrote:
Hello,

I have hit the "Cannot open any more databases" and "System resource
exceeded" errors. Knew this was coming, but as I got closer to finishing the
database, I hoped it wouldn't be an issue.

My DB consists of hundreds of unique pieces of information (in atomic tables
of course). However, I have many multiple queries that are required to
compile information and conduct various calculations to put it in a workable
format for reports and forms.

My posed question:

1) Should I have the "queries" execute on the forms/reports themselves using
VB code or
2) Should I rework my database design to improve effeciency

Right now a particular form may refer to a query that refers to multiple
queries and tables.

Thanks for your help!

B

--
Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/2007...
I've run into that quite a few times as well. Since you already have
it almost done the easiest solution would be to replace your queries
with VBA code, as this does not really count toward your object limit.
Remember that tables and queries count more then once toward the
number limits imposed, once just to exist, and an additional count for
every active reference.

You should be able to eliminate just about all of your queries with
VBA through executing any queries or setting rowsources for report
queries.


Aug 15 '07 #4
bhipwell via AccessMonster.com wrote:
Where I am stuck right now is with a query. If I right click on it and
select design, I get "System resource exceeded." I can get it in datasheet
view and SQL, however. It is a messy query that uses other queries so I can
populate a report. (A2000)

Untangling this could be a mess. I was think I may just have the report make
queries for itself.
I would agree it's a mess.
Any thoughts?

B
Goto google groups and search for your errors. Search in *access* group
textbox.
Aug 15 '07 #5
Ben,

As I understand it, you cannot use SQL in the control source of a field. Do
you suggest populating the text boxes on my report using VBA during an OnOpen
event?

B

--
Message posted via http://www.accessmonster.com

Aug 15 '07 #6
I'm sorry, but I don't understand what you have, or what you are trying to
accomplish, starting with "hundreds of unique pieces of information in
atomic tables." Perhaps you could clarify just a bit...

Databases are great for storing and retreiving information... they aren't
necessarily all that great for performing complex calculations. Sometimes
it's better to do the calculations in a spreadsheet, and get the data from a
database, or sometimes it's better to do those calculations in code.

If we are given something more than a vague description of what you have and
what you're trying to do, it's likely that someone could offer some useful
suggestions. As you can guess, "Can't open more databases" and "System
resource exceeded" are so generic that there isn't a specific solution
anyone can offer.

Larry Linson
Microsoft Access MVP
"bhipwell via AccessMonster.com" <u30281@uwewrote in message
news:76bcb996512ed@uwe...
Hello,

I have hit the "Cannot open any more databases" and "System resource
exceeded" errors. Knew this was coming, but as I got closer to finishing
the
database, I hoped it wouldn't be an issue.

My DB consists of hundreds of unique pieces of information (in atomic
tables
of course). However, I have many multiple queries that are required to
compile information and conduct various calculations to put it in a
workable
format for reports and forms.

My posed question:

1) Should I have the "queries" execute on the forms/reports themselves
using
VB code or
2) Should I rework my database design to improve effeciency

Right now a particular form may refer to a query that refers to multiple
queries and tables.

Thanks for your help!

B

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200708/1

Aug 16 '07 #7
Larry,

Thanks for your reply. I was able to fix my problem by going back to a saved
backup and rebuilding up to the point where the error occured. By hundreds
of pieces of information, I meant fields. By atomic, I meant that I have a
bunch of smaller tables to ensure no duplication of data.

I am in the process of reworking some of my queries as they are quite over
the top with too many fields and complex calculations.

I had just never seen the "System Resource Exceeded" error before and
couldn't understand why the error was only occuring when I wanted to view a
query in design view only since the query would run find as a datasheet or in
SQL view mode.

Thanks agains! (I have picked up alot of great info from posts you have on
other threads, thanks for those too)

B

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200708/1

Aug 16 '07 #8
Ben
On Aug 15, 10:22 am, "bhipwell via AccessMonster.com" <u30281@uwe>
wrote:
Ben,

As I understand it, you cannot use SQL in the control source of a field. Do
you suggest populating the text boxes on my report using VBA during an OnOpen
event?

B

--
Message posted viahttp://www.accessmonster.com
Not really, I guess I misunderstood the structure of your application.
My suggestion was to reduce the number of objects by replacing all
possible queries with VBA based queries. Your right that the control
source can't be sql but there are other ways around that. The simplist
being to store all your query sql in a table and then create the
queries when the report is selected from a form and delete them when
the form is closed. Not a robust solution by any means, but if you are
working with a large number of tables to prevent data duplication(?)
then it doesn't seem like it would need to be a robust solution. Just
something to get the job done.

Aug 16 '07 #9
I went back to a recently saved filed and worked through the error I was
having. The error has since disappeared, however I need to address the
structure of my queries. I think I may take your approach when I begin
cleaning them up.

Quick question, I am just fine at writing VBA code, but a little weak in SQL.
I can struggle through it for awhile until I get the hang of it. Any advise
to get a cliff notes version of writing SQL?

B

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200708/1

Aug 16 '07 #10
Quick question, I am just fine at writing VBA code, but a little weak in SQL.
I can struggle through it for awhile until I get the hang of it. Any advise
to get a cliff notes version of writing SQL?
Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/2007...
Use the query designer to create your query, flip over to SQL view,
then copy & paste into the VBA module. You will have to do some
creative quoting and such but it's not that bad.
Aug 17 '07 #11
Ben
On Aug 16, 12:14 pm, "bhipwell via AccessMonster.com" <u30281@uwe>
wrote:
I went back to a recently saved filed and worked through the error I was
having. The error has since disappeared, however I need to address the
structure of my queries. I think I may take your approach when I begin
cleaning them up.

Quick question, I am just fine at writing VBA code, but a little weak in SQL.
I can struggle through it for awhile until I get the hang of it. Any advise
to get a cliff notes version of writing SQL?

B

--
Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/2007...
I'm sure there are tons of guides and quick learning books available
for ramping up SQL skills. But I think the best way to learn is to
just do it. To that end Bill's suggestion is probably best. Just look
at the SQL your query designer builds, it helps to indent it and
separate out the lines in a text editor to see what you are doing,
then just paste it into VBA.

You probably know all this from your VBA experience but I think it
bears repeating.

If the queries are short enough then just put it all on one line:

currentdb.execute "update mybesttable set status = 1"

if the query is longer you need to keep it all together by adding " &
_ " at the end of each line and making sure each portion of the
statement is enclosed in quotes. The funky quotes come into play if
you have text references in your query criteria because text
references are surrounded by quotes. When you run a query in VBA its
like another level of processing so you need to write the query to
accommodate that. A single quote must be written as a double quote for
it to be read as a single quote:

currentdb.execute "update mybesttable " & _
"set status = 2 " & _
"where first_name = ""Bill"" " & _
"and status = 1"
Aug 17 '07 #12
Thanks for the kind words. I'm glad you made progress. Questions that are
both precise and concise have the best chance of getting good answers in
newsgroups, and specific questions are more likely addressable than general
ones. There are, as you probably know, good suggestions on effective use of
newsgroups at the FAQ for this newsgroup at
http://www.mvps.org/access/netiquette.htm and the site
http://www.mvps.org/access/ is full of good information from very
knowledgeable Access users and developers.

Regards,
Larry Linson
Microsoft Access MVP
Aug 19 '07 #13

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

Similar topics

0
6164
by: Dan | last post by:
I am working with the C-API to MYSQL Ver 12.16 Distrib 4.0.5a-beta, for pc-linux (i686). I have noticed the following problem. Within my C program I issue --- conn = mysql_init(NULL); conn =...
1
7397
by: Kevin Frey | last post by:
Hello, I have a test database with table A containing 10,000 rows and a table B containing 100,000 rows. Rows in B are "children" of rows in A - each row in A has 10 related rows in B (ie. B has...
3
3826
by: Vithar | last post by:
I have a database that is being used as sort of a reports data warehouse. I use DTS packages to upload data from all the different sources. Right now I have it truncating the tables and appending...
33
5505
by: Joshua D. Drake | last post by:
Hello, I think the below just about says it all: http://www.commandprompt.com/images/mammoth_versus_dolphin_500.jpg Sincerely, Joshua Drake
0
1047
by: Bigal | last post by:
If I want to create a ListBox filled by a database query, it is not recommended to enable the viewstate of the form, because it does not make sense to reconstruct the whole and costs performance....
2
4157
by: Jon Lapham | last post by:
I have a table that stores TEXT information. I need query this table to find *exact* matches to the TEXT... no regular expressions, no LIKE queries, etc. The TEXT could be from 1 to 10000+...
3
3023
by: MP | last post by:
context: vb6/ ado / .mdb format / jet 4.0 (not using Access - ADO only) - creating tables via ADO (don't have access) - all tables have a primary key (PK) - many of the PK will become FK(Foreign...
13
4997
by: JayCallas | last post by:
I know this question has been asked. And the usual answer is don't use cursors or any other looping method. Instead, try to find a solution that uses set-based queries. But this brings up...
4
3376
by: raylopez99 | last post by:
I'm reading a book that talks about how some operations, like LINQ queries, are "deferred execution" while other queries are "immediate execution". What is the difference? RL
0
7223
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
7319
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
7376
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...
1
7031
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
7485
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
5623
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,...
1
5042
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
4702
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...
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.