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

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-->AgencyContacts

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.DPriority='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 2766
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*********************@news.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-->AgencyContacts

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.DPriority='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
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...
7
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...
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...
8
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. ...
17
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...
52
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...
9
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...
18
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...
9
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
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...

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.