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

Query Def and multi user environment

I'm trying to build a search utility for users to find 'inquiries' in
my database that involves several tables. This is normally easy to do
with the query builder, but I have a unique situation involving a multi
select listbox. Unfortunatly, my SQL skills are somewhat limited, so
I'm not sure if there is an easy way around it. To simplify the
explanation, I'll simplify the table/field setup to get at the meat of
the question.

I have a table with a field called IssueID in table tblMain, and
another field called ProductType in tblProductType. Each IssueID may
have many ProductTypes. tblMain and tblProductType linked together in a
one to many relationship.

Now, I have a search form, which allows users to enter in parameter
query criteria for tblMain. However, criteria for the linked table
tblProductTypes are in a multi select list box. Clicking the 'Find'
button needs to find all matches in tblMain limited to only IssueID's
that contain at least one of the ProductTypes in tblProductType.

It's easy enough to build an SQL statement of the listbox by cycling
through all selected objects and concatenating a string together. The
sticking point is that I need (well, at least I think I need) an actual
object to reference for the INNER JOIN statement in the SQL statement
for tblMain.

I researched some code for QueryDef's, but I'm not sure this will do
the trick. I found the following code in the Help File, which is easy
enough to understand.

Sub NewQuery()
Dim dbs As Database, qdf As QueryDef
Dim strSQL As String

' Return reference to current database.
Set dbs = CurrentDb
' Refresh QueryDefs collection.
dbs.QueryDefs.Refresh
' If RecentHires query exists, delete it.
For Each qdf in dbs.QueryDefs
If qdf.Name = "RecentHires" Then
dbs.QueryDefs.Delete qdf.Name
End If
Next qdf
' Create SQL string to select employees hired on or after 1-1-94.

strSQL = "SELECT * FROM Employees WHERE HireDate >= #1-1-94#;"
' Create new QueryDef object.
Set qdf = dbs.CreateQueryDef("RecentHires", strSQL)
' Open query in Datasheet view.
DoCmd.OpenQuery qdf.Name
Set dbs = Nothing
End Sub

The problem here is that I'm seeing the old query getting deleted and a
new one made each time this would run. I'm thinking that could be a
problem in a multi user environment if two users clicked the 'Find'
button at the same time. I.E., the queryDef is made by User1, but
before the SQL statement executes to reference that new query, User2
has already deleted and replaced the query with their own criteria
based off the multiple objects user2 selected in the listbox.

Is there a way I can do this all in a single SQL statement? Or are my
fears about queryDefs in multi-user environments unfounded?

Thanks in advance for any help or advice any of you may have.

Jun 13 '06 #1
4 3153
The problem here is that I'm seeing the old query getting deleted and a
new one made each time this would run. I'm thinking that could be a
problem in a multi user environment if two users clicked the 'Find'
button at the same time. I.E., the queryDef is made by User1, but
before the SQL statement executes to reference that new query, User2
has already deleted and replaced the query with their own criteria
based off the multiple objects user2 selected in the listbox.

Is there a way I can do this all in a single SQL statement? Or are my
fears about queryDefs in multi-user environments unfounded?

Why would this be a problem at all if you split the FE and BE? Then
the qdf would be in the copy of the FE on the local machine, so by
definition, only one user could use that qdf at a time....

Jun 13 '06 #2

pi********@hotmail.com wrote:
The problem here is that I'm seeing the old query getting deleted and a
new one made each time this would run. I'm thinking that could be a
problem in a multi user environment if two users clicked the 'Find'
button at the same time. I.E., the queryDef is made by User1, but
before the SQL statement executes to reference that new query, User2
has already deleted and replaced the query with their own criteria
based off the multiple objects user2 selected in the listbox.

Is there a way I can do this all in a single SQL statement? Or are my
fears about queryDefs in multi-user environments unfounded?

Why would this be a problem at all if you split the FE and BE? Then
the qdf would be in the copy of the FE on the local machine, so by
definition, only one user could use that qdf at a time....

I wish I could split it. But, I'd have to distribute the FE to 500+
people (It has low numbers of concurrent users before any of you freak
out), and any time a change was made I'd then have to figure out an
effective means of redistributing it to all 500 people. Since it's not
a capital project, the IS department wont give me any backup by just
pushing it out to the designated users.

It's basically a research tool that people will be using infrequently
(perhaps two or three times a month for some). They don't use it often,
but when they do it has to work without any hassles. (such as upgrading
their FE to the latest version).

If I could develop something I knew I'd never have to change, then I'd
do it in a heartbeat. However, they are constantly re-organizing
departments and/or workflows, which can require significant changes to
the UI. In short, this is something that I have to constantly maintain,
and that just isn't easy to do in a FE/BE setup.

Jun 14 '06 #3
Okay, I see the problem!

You could do something like grabbing the currentuser or the machine
name and save the query with that name, which would make it unique.
(Or some variation of that, say as a suffix)

You might want to look at Tony Toews' site to read up on distributing
the FE automatically. Not trying to do the fingerwag thing, but just
open up some options you may not have considered.

http://www.granite.ab.ca/access/ufad.htm

Tony covers a lot of common problems, so you might want to take a look
before you write FE distribution off.

Hope it helps,

Pieter

Jun 14 '06 #4
Some good ideas there. I am already capturing Novel login names for
other purposes, makes sense that I could use that to prevent
collisions.

And thanks for the pointer to the Automatic FE distributer. I'll check
that out. A performance gain from distributed setup would certainly be
welcome as this database is beginning to chug under current workload.

Jun 15 '06 #5

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

Similar topics

1
by: Job Lot | last post by:
In a multi-user environment, how would I prevent users from adding Orders with identical OrderID. For instance I have following tables in my database Order ================== OrderID Identity...
2
by: Scott Bryce | last post by:
I am creating a CGI application in Perl that uses an Access database. It will be hosted on an NT server. I have used flat file DBMs (tied hashes) on UNIX servers, but I am not familiar with how...
11
by: deko | last post by:
If I release a new version of my mbd (in mde format) and users want to upgrade - how do they migrate their data? For example, if the original was released as data1.mde and then I release...
5
by: premmehrotra | last post by:
I currently have a multi-user access database which is put on a shared drive L: on a Windows Servers. Entire database is one file premdb.mdb. Users access this database from their laptops....
3
MMcCarthy
by: MMcCarthy | last post by:
I know this question has been covered extensively in the past, but I'm wondering if anyone has any new thoughts on the subject. I have a Frontend/Backend Ms Access database. The frontend will be an...
2
by: john | last post by:
Is it true that if I split my access database in backend and frontend and I implement custom auto increment for the ID fields, that my database is ready to be used in a multi-user environment? I...
3
by: olafbrungot | last post by:
I get the following error message when trying to connect to a host database (OBCD connection) with "MS Query". SQL0471N Invocation of routine "SYSIBM .SQLTABLES " failed due to reason...
7
by: irfanali | last post by:
Hallo All, I m trying to create a Multi User Data Program on Access, where my team members would input data on a daily basis. Well the Problems start now : - How do i create a Multi-user...
0
by: mirandacascade | last post by:
Apologies in advance for what I'm guessing may be a trivial question. Assume the following: 1) multi-user environment 2) standard (i.e. not a class module) module with: Public strSample as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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: 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
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
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...

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.