473,769 Members | 2,376 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Fixing a complex Access problem, looking for either a SQL, VB, or Design View solution

I'm trying to fix a glitch in a complex access database, and have a
fairly complex problem... unless there's some obscure easy fix I don't
know being fairly new with Access. Basically, the area I'm trying to
fix includes a form which takes entered data, concatenates it into a VB
string to form an SQL query, then launches a report with information
from the query. Several tables are linked in the query, but the key
ones for this problem are like this:

Project<-->Agency-->AgencyContac ts

The report will display a list of 'Projects', grouped by 'Agency', with
an option to include contact information. For the purpose of the
reports, there's only one type of contact out of several that I want:

WHERE ...
AND AC.DPriority = 'Primary' AND AC.[Inactive?]= No

Initially this line was in the main body of the code, not in an IF
statement, so it was being applied to all queries.

Where the problem starts, is when there is no 'Primary' contact for an
Agency, and keep in mind that the contact information is just sort of
side note, any Project linked to that Agency will be filtered out of the
report. What I want to do is keep the project there but do not include
anything for the contact.

Usually this is not a problem, but there's the odd case where we want
contact information included, and the rare Agency that doesn't have a
'Primary' contact. It's pretty obscure and very easy to miss on the
report.

This is my progress so far. First, I moved the WHERE clause statements
listed above into the SELECT statement using an IIF, within the VB IF
statement for when the contacts checkbox is ticked, and leave the field
as blank '' as the alternative:

IIf(AC.DPriorit y='Primary' AND AC.[Inactive?]=No,"Contact Name: " &
AC.Name,'') AS ContactName,
... AS ContactPhone
... etc

This appeared to work at first. However, this selects all contacts, not
just the Primary, and while it doesn't display anything for them, it
makes duplicate copies of the project and messes up the report.

I was about to post here when I thought I had it fixed again, by opening
up the design view for the report itself, and setting duplicate values
to be invisible. I just realized this morning however, that while that
will not show anything, it just leaves a lot of whitespace instead.

So to sum it up, it's sort of a square peg round hole problem. I want
to select one specific value for a couple of columns from a seperate
table, and if it's not there, still maintin the row for the query, with
blank values for those column. Not eliminate the entire row, or create
duplicates. So does anyone have a suggestion on how I can get this
done? Either through an SQL statement, VB code, or Report design?

*** Sent via Developersdex http://www.developersdex.com ***
Jun 6 '07 #1
1 2820
Access can do this, if you can't get it with a normal WHERE. Create a 2nd
query to select the ODD records. Open the original query that selects all
but the odd records switch to SQL view and add UNION ALL to the end then
add the SQL string from the 2nd query. This should return all the normal
records 1st and the ODD records at the end.

"Randy Volkart" <ra*****@yahoo. cawrote in message
news:46******** *************@n ews.qwest.net.. .
I'm trying to fix a glitch in a complex access database, and have a
fairly complex problem... unless there's some obscure easy fix I don't
know being fairly new with Access. Basically, the area I'm trying to
fix includes a form which takes entered data, concatenates it into a VB
string to form an SQL query, then launches a report with information
from the query. Several tables are linked in the query, but the key
ones for this problem are like this:

Project<-->Agency-->AgencyContac ts

The report will display a list of 'Projects', grouped by 'Agency', with
an option to include contact information. For the purpose of the
reports, there's only one type of contact out of several that I want:

WHERE ...
AND AC.DPriority = 'Primary' AND AC.[Inactive?]= No

Initially this line was in the main body of the code, not in an IF
statement, so it was being applied to all queries.

Where the problem starts, is when there is no 'Primary' contact for an
Agency, and keep in mind that the contact information is just sort of
side note, any Project linked to that Agency will be filtered out of the
report. What I want to do is keep the project there but do not include
anything for the contact.

Usually this is not a problem, but there's the odd case where we want
contact information included, and the rare Agency that doesn't have a
'Primary' contact. It's pretty obscure and very easy to miss on the
report.

This is my progress so far. First, I moved the WHERE clause statements
listed above into the SELECT statement using an IIF, within the VB IF
statement for when the contacts checkbox is ticked, and leave the field
as blank '' as the alternative:

IIf(AC.DPriorit y='Primary' AND AC.[Inactive?]=No,"Contact Name: " &
AC.Name,'') AS ContactName,
.. AS ContactPhone
.. etc

This appeared to work at first. However, this selects all contacts, not
just the Primary, and while it doesn't display anything for them, it
makes duplicate copies of the project and messes up the report.

I was about to post here when I thought I had it fixed again, by opening
up the design view for the report itself, and setting duplicate values
to be invisible. I just realized this morning however, that while that
will not show anything, it just leaves a lot of whitespace instead.

So to sum it up, it's sort of a square peg round hole problem. I want
to select one specific value for a couple of columns from a seperate
table, and if it's not there, still maintin the row for the query, with
blank values for those column. Not eliminate the entire row, or create
duplicates. So does anyone have a suggestion on how I can get this
done? Either through an SQL statement, VB code, or Report design?

*** Sent via Developersdex http://www.developersdex.com ***

Jun 7 '07 #2

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

Similar topics

1
1429
by: Michel Laan | last post by:
Hi, I am running a financial database on SQL 7.0. For several reasons I cannot upgrade to another version shortly. My problem is that I need to create database users that have limited access to a number of tables. Example: tableX: code, value, type a, 100, x
7
8869
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I want my users to be able to select a report, click on a command button on a form, which will then automatically create the report as a pdf file and save it to the user's machine. I am using Adobe Acrobat (5.0 I think) and have Adobe Distiller as a
11
6600
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 where the job is running, the job runs sucessfully, PDF files got generated, everything is good. If I scheduled the job to run at the time that I am not logged into the server, Access is not able to print to the printer. The error is pretty...
8
2962
by: Steve Jorgensen | last post by:
Mailing List management is a good example of a case where my conundrum arises. Say there is a m-m relationship between parties and groups - anyone can be a member of any combintation of groups. Now, let's say the user wants to be able to send mailings to people who have various combinations of membership and non-membership in those groups. Here's a medium-complex example: (Knitting Group or Macrame Group) and Active Contact and Mailing...
17
2496
by: DaveG | last post by:
Hi all I am planning on writing a stock and accounts program for the family business, I understand this is likely to take close to 2 years to accomplish. The stock is likely to run into over a thousand items and the accounting side will be used for hopefully many years so the entries are likely to be vast. The delema is what is best to use ase the DB engine, Access I have as part of Office 2002 or should I really be looking at SQL...
52
9983
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server 2005, and, since he already has licenses for Office Pro 2002, he wants to upgrade to that. I've been saying that we need to upgrade to Access 2003, not 2002, even if Office is kept at 2002. We are also looking to do a fair amount of...
9
3063
by: Alan Mailer | last post by:
Ok, my Access 2002 language writing skills are VERY rusty,. I would know how to do what I need using SQL Server's "Coalesce' function, but I don't have that available to me in the Access 2002 database I'm currently programming. ....So could someone advise me how to add an Expression Field to a Access 2002 Query that will reflect the following: Imagine I want a field that derives from Fields in a table I've called tblContacts. ...
18
7855
by: njgreen2001 | last post by:
I thought the length of this might give me problems. Any suggestions on how to shorten it? Expression: =IIf(="A Pos" And ="A Pos",(DLookUp("","")), IIf(="A Pos" And ="A Neg",(DLookUp("","")), IIf(="A Pos" And ="B Pos",(DLookUp("","")), IIf(="A Pos" And
9
4496
by: prakashwadhwani | last post by:
Hi !! I'm about to develop a new project for a client. Should I go about it in Access 2003 or 2007 ? Purchasing it either for me or for my client is not a major consideration here ... what I'd like to know is the stability, speed & ease of use of both the products. I believe Access 2007 has a new file format too and that it may be slower.
0
9586
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10210
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10043
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9990
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9861
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2814
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.