473,800 Members | 2,518 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pull current months data

how do you pull the current months data without having to manually
input the date each time?

Oct 19 '06 #1
5 2957

RandyG wrote:
how do you pull the current months data without having to manually
input the date each time?
Something like

SELECT...
FROM ...
WHERE Month(tbl.Datef ield)=Month(Dat e()) And
Year(tbl.DateFi eld)=Year(Date( ))

Oct 19 '06 #2
that worked thanks.

Now what i just noticed, im pulling information for month end reports
that shows data from years prior to the current report month. How can i
pull the current months information and prior report information?


On Oct 19, 3:00 pm, "RandyG" <astr...@gmail. comwrote:
how do you pull the current months data without having to manually
input the date each time?
Oct 19 '06 #3

RandyG wrote:
that worked thanks.

Now what i just noticed, im pulling information for month end reports
that shows data from years prior to the current report month. How can i
pull the current months information and prior report information?


On Oct 19, 3:00 pm, "RandyG" <astr...@gmail. comwrote:
how do you pull the current months data without having to manually
input the date each time?
I don't understand. If you have a filter for Year and for Month you
should be OK. post your SQL.

Oct 20 '06 #4
RandyG wrote:
that worked thanks.

Now what i just noticed, im pulling information for month end reports
that shows data from years prior to the current report month. How can i
pull the current months information and prior report information?


On Oct 19, 3:00 pm, "RandyG" <astr...@gmail. comwrote:
how do you pull the current months data without having to manually
input the date each time?
SELECT IIf(DateField BETWEEN MonthStartDate AND MonthEndDate,
DataValueField, 0) AS MonthData FROM tblX WHERE DateField BETWEEN
PeriodStartDate AND PeriodEndDate;

Any DateField value outside the month will return 0 for MonthData, so
summing all the MonthData values will give you the sum for that month
even though the query returns all the records within the period.
Replace DataValueField with a 1 if a count rather than a sum is needed.

Note that there should be no time portion stored in the date fields
when using BETWEEN, otherwise you'll need to add a day to the second
date. For a given date, say dtX, the beginning of the month containing
dtX can be found using DateSerial(Year (dtX), Month(dtX), 1) and the end
of the month containing dtX can be found using DateSerial(Year (dtX),
Month(dtX) + 1, 0).

I hope this helps you get the information you need.

James A. Fortune
CD********@Fort uneJames.com

That time of year thou may'st in me behold
When yellow leaves, or none, or few, do hang
Upon those boughs which shake against the cold
Bare ruin'd choirs, where late the sweet birds sang.
-- Shakespeare, Sonnet 73

Oct 20 '06 #5
RandyG wrote:
how do you pull the current months data without having to manually
input the date each time?
This would be more efficient than using Month() if your date field is indexed.

SELECT *
FROM TableName
WHERE DateField >= DateSerial(Year (Date()), Month(Date()), 1)
AND DateField < DateSerial(Year (Date()), Month(Date()) + 1, 0)
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Oct 20 '06 #6

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

Similar topics

19
2437
by: Caesar | last post by:
Hi, I'm wondering if anyone here can point me in the right direction. My host does not provide php, and so I need to pull this data from another server that does support such scripting. Help? JC
5
7260
by: Julia Baresch | last post by:
Hi everyone, I haven't found any reference to this problem on this group or in Access 97 help. I hope someone here knows this - probably a simple thing, but not obvious. I designed a query to pull payment data from my database for accounting. It has 3 tables with one-to-many joins: Table1 --> one-to-many --> Table2 --> one-to-many --> Table3 The payment amount field is in Table3. I entered a few negative
1
3154
by: Nick J | last post by:
Hi, I have a command button, when I press it I would like it to find the record I have specified in a text box on the current form and to pull fields such as Address 1 and Address 2 from another table into text boxes on the current form. The fields that are pulled into the current form need to be stored in the table for the current form, so I do not beleive I could use DLookUp because they will not be stored? only displayed.
2
3775
by: Nick | last post by:
What I want to do is have 2 pull down lists, for example a state pull down list and a city pull down list. What I would like to have done is when you select a state from the state pull down list then the city pull down list will populate with all the cities from that selected state. I know that is a lot of data but that is just an example. Or something like when you are looking up cars online they have a make pull down list and a model...
3
1518
by: jjgardner3.web | last post by:
Hello I have a very simple xml file: <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="./status.xsl"?> <IEC> <Workstation> <Hostname>HOSTNAME</Hostname> <CurrentPkg>PKGNAME</CurrentPkg> <TimeRunning>15 min</TimeRunning>
14
3505
by: Tina | last post by:
My employer tracks productivity/performance of clinicians (how much they bill) each week, its averages for the month, and the 6 months. These averages are compared to their expected productivity. However, the expectation changes - it may be 60% for a while, then change to 50%. Initially, I was averaging the expectation, along with the productivity, but what I'm being asked is to look at the average productivity/performance compared to...
4
1941
by: sparks | last post by:
We have a new project here, one that I have never tried maybe its easy I don't know yet. We have people that have records dating back over 5 yrs on a sql server. We have to build an access 2003 database for data entry of the people then pull data from the sql server to fill in data for these records. that sounds good....except to start I need record # and date....no problems there.
3
10819
by: remya1000 | last post by:
i'm using ASP with MSAccess as database. i have two buttons and two textbox in my page. when i press my first button (First month) i need to display the current month in one textbox and last one months date in another textbox. and while pressing the second button (submit) i need to display the date displayed in the textbox as itself and the records between thoses two dates. if that date is still there in the textbox only i can sort the...
11
2469
by: Harlin Seritt | last post by:
Is there a module that can pull str values for say the last 3 months? Something like: print lastMonths(3) Thanks
0
9690
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
9550
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10501
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
10273
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
10250
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
9085
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7574
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 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...
0
6811
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();...
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.