I am running in ACCESS 2003 a database with a single table. It
records service rendered to clients of a food pantry. As each client
is served the date is entered into 1-6 fields SvcDate1, SvcDate2 etc.
I would like to query certain data for monthly periods. The date of
the month may appear in any one of the six fields. I now am running
the query for each of the fields separately. Is there any way I can
write a query that will respond to the dates in any and all of the
service date fields?
I understand the dates should have been in a separate table but I
inherited this application and am trying to make the best of it.
Thank you,
Stan Hanna 4 1777
On May 8, 2:10 pm, Stan <stanha...@hotm ail.comwrote:
I am running in ACCESS 2003 a database with a single table. It
records service rendered to clients of a food pantry. As each client
is served the date is entered into 1-6 fields SvcDate1, SvcDate2 etc.
I would like to query certain data for monthly periods. The date of
the month may appear in any one of the six fields. I now am running
the query for each of the fields separately. Is there any way I can
write a query that will respond to the dates in any and all of the
service date fields?
I understand the dates should have been in a separate table but I
inherited this application and am trying to make the best of it.
Thank you,
Stan Hanna
Hello Stan,
Perhaps one way you could do this it to enter the following into
the criteria for each field: [Enter Date]. Just make sure that
it is placed on the next line down for each "or" line. Just enter
the date your searching for once when the query in run and
you should get the lines that correspond to your date.
Also, if getting a result based on a form, enter the path
of the control with the date to be searched in the same way.
Example: Forms!frmNameHe re.ControlNameH ere
while placing it on each or line for each field.
Good luck.
Hi Stan,
Your scenario sounds like you have an unNormalized DB - serveral date
columns in one table. The (simplified) rule for normalization is that
you have one column for each datatype in a table - the detail table that
is. So your detail table would look something like this:
DayOfService ServiceDate
svcdate1 1/1/07
svcdate1 2/1/07
svcdate1 1/19/07
svcdate2 ...
svcdate2
svcdate3
svcdate3
svcdate2
svcdate1
svcdate1
This way you can easily query on any given DayOfService for a range
ServiceDate Between date1 and Date2.
Rich
*** Sent via Developersdex http://www.developersdex.com ***
On May 8, 7:01 pm, inkman04 <raycai...@yaho o.comwrote:
On May 8, 2:10 pm, Stan <stanha...@hotm ail.comwrote:
I am running in ACCESS 2003 a database with a single table. It
records service rendered to clients of a food pantry. As each client
is served the date is entered into 1-6 fields SvcDate1, SvcDate2 etc.
I would like to query certain data for monthly periods. The date of
the month may appear in any one of the six fields. I now am running
the query for each of the fields separately. Is there any way I can
write a query that will respond to the dates in any and all of the
service date fields?
I understand the dates should have been in a separate table but I
inherited this application and am trying to make the best of it.
Thank you,
Stan Hanna
Hello Stan,
Perhaps one way you could do this it to enter the following into
the criteria for each field: [Enter Date]. Just make sure that
it is placed on the next line down for each "or" line. Just enter
the date your searching for once when the query in run and
you should get the lines that correspond to your date.
Also, if getting a result based on a form, enter the path
of the control with the date to be searched in the same way.
Example: Forms!frmNameHe re.ControlNameH ere
while placing it on each or line for each field.
Good luck.
Sounds like a good suggestion. I will have to try playing around with
it. First attempt worked for the first two service dates but some
problems with the following. I will work on it and with you
permission be back to you will further questions.
Thanks
Stan
If you are stuck with the non-normalized structure, you can create a
UNION query that will join the identically structured output from
several subqueries into a single result set.The UNION query can then
be used as the source for your search.
A UNION query is read-only. Also, you can't use the graphic query
builder to create a union query, you have to do it in SQL view. I
usually build the first pass/extract in the query builder, then switch
to SQL view and copy and alter the structure for each remaining pass.
<uncompiled SQL>
SELECT svcClientName as Name, svcClientID as ClientID, svcDate1 as
svcDate FROM aServiceHistory WHERE svcDate1 Is Not Null
UNION
SELECT svcClientName as Name, svcClientID as ClientID, svcDate2 as
svcDate FROM aServiceHistory WHERE svcDate2 Is Not Null
UNION
SELECT svcClientName as Name, svcClientID as ClientID, svcDate3 as
svcDate FROM aServiceHistory WHERE svcDate3 Is Not Null
UNION
SELECT svcClientName as Name, svcClientID as ClientID, svcDate4 as
svcDate FROM aServiceHistory WHERE svcDate4 Is Not Null
UNION
SELECT svcClientName as Name, svcClientID as ClientID, svcDate6 as
svcDate FROM aServiceHistory WHERE svcDate6 Is Not Null
ORDER BY Name, SvcDate;
</uncompiled SQL>
Save that query. Create a second query that uses the UNION query as
the data source, and you can then sort/search/filter on any of the
fields in the UNION.
Good luck!
Ron, King of Chi
On May 8, 5:10 pm, Stan <stanha...@hotm ail.comwrote:
I am running in ACCESS 2003 a database with a single table. It
records service rendered to clients of a food pantry. As each client
is served the date is entered into 1-6 fields SvcDate1, SvcDate2 etc.
I would like to query certain data for monthly periods. The date of
the month may appear in any one of the six fields. I now am running
the query for each of the fields separately. Is there any way I can
write a query that will respond to the dates in any and all of the
service date fields?
I understand the dates should have been in a separate table but I
inherited this application and am trying to make the best of it.
Thank you,
Stan Hanna
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Steve |
last post by:
I have a products table where the PK is ProductID. Also have the standard Orders
table and OrderDetails table. I created a query that joins the Orders table and
OrderDetails table. The query includes the OrderDate field from the Orders table
and the ProductID field from the OrderDetails table. I added a criteria to the
OrderDate field to limit the orders to the past year. Then I converted the query
to a totals query to get the total sold of...
|
by: rrh |
last post by:
I am trying to update a field in one table with data from another
table. The problem I'm running into is I need to base the update on a
range of data in the 2nd table.
Table 1 has:
date field
new field
table 2 has:
key field (autonumber)
|
by: GorDon |
last post by:
Hi,
I have a report based on a query. The query grabs a memo field from
my main table, yet when I display the memo field in the report it
truncates the memo field (the field needs to hold more than 255
characters). The table holds all the memo text, but the query seems
to truncate the memo field to 255 chars?
This seems like there should be a relatively easy fix, but I can't
seem to find it.
|
by: Steve Housechild |
last post by:
I have a table of 'Customers', a table of 'Newsletters' and a table
for storing which customers have recieved which letters 'CustLett'.
By using a query, I have pulled a list of customers who qualify for
newsletter No.1. The are displayed using a subform for viewing
purposes.
What I want to do now (in one swift action) is to add the customer
account no's to the table 'CustLett' along with the ID of Newsletter
No.1. I think I can do...
|
by: Martin Lacoste |
last post by:
(Access 2000)
Two issues:
Within a query, I need to return a field name as data (see eg. below).
I need to search within 80 fields (same criteria) - is there a way to
avoid 80 separate expressions (the 80 field names are stored in a
table - can I get the query to look each of these up?)?
Here's an example:
| |
by: GL |
last post by:
Hi,
Is there a way to add a field to an existing table using a query of
some sort (without needing to manually add a field to the table). I
know how to do it with a make table query, but I have a specific need
to only add a new field to a table if possible. Here's a simplified
example of what I'm trying to do:
I get a file with the following two fields:
First Name
|
by: rednexgfx_k |
last post by:
All,
Problem Summary: I've running about 30 make table queries via VBA in
Access 2000, and my database goes from 14,000k to over 2,000,000k. In
addition, the longer the procedure runs, the bigger the performance hit
VBA takes. I'm wondering how to prevent or reduce this.
Details: I have a database table of queries I want to run. This table
contains the query name, the SQL text of the query, the name of the
target table, and whether...
|
by: Maxi |
last post by:
There is a lotto system which picks 21 numbers every day out of 80
numbers.
I have a table (name:Lotto) with 22 fields (name:Date,P1,P2....P21)
Here is the structure and sample data:
"Date","P1","P2","P3","P4","P5","P6","P7","P8","P9","P10","P11","P12","P13","P14","P15","P16","P17","P18","P19","P20","P21"
1/1/2005,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21
1/2/2005,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22
|
by: John Øllgård Jensen |
last post by:
Hi
Using MS Asccess 2000:
In a query I'm trying to create a new field with following expression:
FilmDate: Left(,4)
The field "FilmNo" is another text field in the query.
This is expression should return the 4 leftmost characters of the FilmNo
|
by: amy |
last post by:
Hi to Everyone:
I need big help on how to query the Age range.
Age field is text data type, Age are from 0 wk, 1 wk, 2wk.....up to 15
wk. Try to set up query in Query desing mode with criteria is 0-4wk, i
put in this: "0 wk" Or "1 wk" Or "2 wk" Or "3 wk" Or "4 wk". The query
result includes ages between1-4wk but also10-15 wk. Even I change the
Age field to number data type, still the same problem.
I am not a access programmer but just...
|
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...
| |
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...
|
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,...
|
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...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |