Using Previous Month's "closing" Value For This Month's "opening"?

Jan 3, 2006

Hello,

I've been looking through the archives and learnt a fair amount about date manipulation, but am still a bit stuck. I'm sure there is a way to do this and would appreciate any ideas:

Basically I am monitoring changes in Fuel level over months. For each month, I have a variety of readings, each on a different table, including sales from that tank, delivery in to it, and most importantly a closing dip reading taken at the end of the month.

In order to figure out the change in Fuel level over each month, you need an "opening" figure : this is taken to be the closing dip value of the previous month. And this is where I'm getting stuck!

I am writing a query to generate new table which combines all the relevent values. I have managed to link them through the date field, even though the specific date is not identical what matters is that it is the same month. Effectively I am trying to add a new 'column' showing the opening value, where opening value = previous months closing value for this tank.

I noticed there is a post talking about previous month data <a href="http://www.access-programmers.co.uk/forums/showthread.php?t=39708&highlight=previous+month">here</a>, which gives me some ideas but I'm not sure how to go about putting this into the SQL query. I can't use Date() because I'm interested in more than just previous to THIS month - the data spans back over a year!

I'm still learning Access so this might be a simple question - if so please point me to the relevent parts of the help file!

many thanks
Catherine

View Replies


ADVERTISEMENT

Previous Month

Apr 24, 2007

I searched but could not find a simple answer.

I want to see all results from last month for [TestDate]

Month(Date())-1) ? ? ? ? ? ? ?

View 3 Replies View Related

Querying Patients From A Previous Month

Mar 1, 2007

I have a query with the following fields:

[Clinic] [Month] [Year] [NewPatients]

Some of the calculations I would like to do are based on the number of new patients that a certain clinic received in the previous month. Does anyone have any suggestions on how I can create a field that has the number of new patients from the previous month?

What I have is this:

PrevMonth: DLookUp("[NewPatients]","ClinicQuery","[Month] = " & [Month]-1)

What I can't figure out is how to account for the fact that I have multiple clinics in the [Clinic] field and each clinic has multiple years in which it was receiving new patients. The PrevMonth statement above works fine for the first clinic listed in the query during the first year it received patients (entries are sorted by month and year), but then just repeats these data for each subsequent year and clinic. Any ideas?

Thanks in advance for any advice!

View 5 Replies View Related

Queries :: Last Thursday Of Previous Month

Jun 27, 2013

How to get the last Thursday of previous month?

For 5 particular queries I need to pull the date range starting at the last Thursday of the previous month forward.

View 1 Replies View Related

Select Month From Previous Selected Year?

Jan 15, 2014

i need 2 comboxes. 1 with year and 1 with month. the year is easy just do this in rowsource sql:

SELECT DISTINCT (DatePart('yyyy',uitvoering.begindatumtijd)) AS Jaar
FROM uitvoering;

but the month is a lot harder because it needs to show the months where the year is the same as the combox with year and only show months where there is data in my table. for example i have data for only 3/12 months in a year then i need to show only those 3 months.i made this in vba because i think it can't be done in rowsource with sql code.

Private Sub Tekst19_Click()
Dim year As Integer
year = Me.Tekst17.Value
CurrentProject.Connection.Execute "SELECT DISTINCT (DatePart('m',uitvoering.begindatumtijd,,)) AS Maand FROM uitvoering WHERE (DatePart('YYYY', uitvoering.begindatumtijd)) = year"
End Sub

View 1 Replies View Related

Queries :: Rolling 12 Month Query - Keeping Track Of Orders Placed For Given Part Number By Month

May 5, 2014

I am trying to create a database that will keep track of the orders placed for a given part number by month. Currently, my table houses the part number, and the ordered amount for the past three years by month (there are thirty-five columns for every part). My column headings are ORDER_MAY_2013, etc. I would like to set a query up that will look at the column headings and pull the amounts ordered for each part for the past twelve months. In other words, I have three years of data in my table. In my query, I just want one year. However, I don't want to have to rewrite the query every month so that it will pick up the new data. Is there a way to accomplish this?

Is there a better way to build this database? I thought about just have four columns in my table - PART_NUMBER, ORDER_MONTH, ORDER_YEAR, ORDER_AMOUNT. The only problem there, is that every part (there are about 450 parts) would have to be listed 35+ times. That seemed too redundant to me, so I built the table this way. However, now I am having trouble querying against it.

View 2 Replies View Related

Calculate Variance Of Payment Month On Month - Values Comparison

Mar 19, 2012

I have a MS access table with 12 numerical columns for 12 Months payments for our customer base.

I need to calculate variance of payments month on month and identify set of customers who have made huge payments.

View 10 Replies View Related

Queries :: Comparison To Previous Month Or Week Depending On The Report

Dec 31, 2014

I have a query based form i use to gather data to generate a report. I have 2 forms Form A is where users open all reports from. On form A i have 2 unbound fields "Report Start Date" and "Report End Date" my queries us these from Form A as the criteria for the queries. I have like 30 reports using this method and it works great. I am now building 2 new reports, a monthly and a weekly report. These reports required and data entry point so i built "Form B"

I created my tables for these reports and went through and created the records. So when a manager needs to enter data for any given report they would us "Report Start Date" to identify what record they want to work with, so if they want to enter data for the December report the would select 12/01/2014 and then open "Form B". This works great and the report looks as good as any Access report can.

Now they are asking to add to "Form B" a comparison to the previous month or week depending on the report. for example:

This month we did 250 units
Last month we did 300 units
so we did 15% less
"Yes my math is not exact"

They don't need to see last months data but i need a way to query the previous record to compare the data

This is the criteria code i use in the query that "Form B" is based on.

Code:
[Forms]![Form A]![Report_Start_Date]

I am pulling up the 12/01/2014 in "Form B" but need the 11/01/2014 record floating behind to compare data.

How can i use the same setup but pull a 2nd record? I am thinking i can use a 2nd query but with different criteria.

View 3 Replies View Related

Matching Current Month With Month In A Table

Oct 18, 2005

I have a table full of dates of meetings through out the year...

Example

tMeetingDates

16th August 2005
18th September 2005
19th October 2005
23rd November


-----

i also have a report that i print out each month that has the date of the meeting on it... i currently edit the date manually.

I was wondering if there was a way to automate this facility, so that the report looked to the table of dates and looked for the current Months Date that is stored i the table.

i then want this date to be displayed in the Report.

So in this instance if i am running a report for tomorrows meeting being the 19th October it would display that date in the report....regardless of when i run the report...

Obviously if i run the report on the first of November because the month has changed it would then display the date of the November Meeting...

we only ever have one meeting a month!!!!

Please help

Andy

View 11 Replies View Related

Forms :: Calendar Scrolling Month By Month

Aug 9, 2013

Using Access 2010..I have form with a date on it. For this control I have show date picker set to "For dates" and lo and behold I get calendar! I can scroll through this calendar month by month. Great if I just want to go back or forward a month or three. What I'd like to be able to do is scroll through the calendar year by year. Can I do this with the method I'm using at the moment? If not is there a way round it that isn't over complicated?

View 6 Replies View Related

Month String To Numerical Month

Oct 13, 2006

HiI have a field that is text which holds the month in form "oct" etc. I need to pass the numerical value of that month to a function so how do I create an expression that will change it (in this instance) to 09.kind regards in advance.peter

View 5 Replies View Related

Month By Month Query

May 17, 2005

please help me

i have a date field called open & i need to generate a query to count all entries by month, so far i can get all cases each day, but i'm unable to get the query to count them just based on the month & year..

any ideas please

View 2 Replies View Related

Forms :: Closing Opening Form With Timer Then Opening Main Menu

Apr 7, 2014

I have a Form opening from Access Options. I would like to close this Form using the Timer. The following is the code I have used but it is not working.

Private Sub Cover_Page_Form_Load()
OpenTimer = Timer
End Sub
Private Sub Cover_Page_Form_Timer()
If (Timer - OpenTime) = 5 Then DoCmd.Close acForm, "Cover_Page_Form", acSaveYes
End Sub

Next question. If I can get this to work can I then use a DoCmd to open new Form within the code above or do I need a new process.

View 5 Replies View Related

Opening & Closing Forms...

Sep 15, 2005

I have an unbound start-up form with a button that I want to open another form. When the user is done with the second form and clicks a close button, I want to bring up the first form.

Q. Is it best to leave the first form open in the background or close and re-open it? (And why?) :confused:

View 2 Replies View Related

Re-opening 'switchboard' After Closing Crosstab Query?

Jan 12, 2006

I have a 'switchboard' form called Menu (not created by access wizard). One of the buttons down the navigation tree opens a crosstab query for the user to examine a data summary; but the 'Menu' form is still visible right in front of the query. Now, I could close the Menu form easily enough when the run query code is triggered, but that would leave the user loose in the database window when they eventually close the crosstab query window.

All that I have read on database navigation says that this is bad thing.

I can't place the crosstab query into a form or report because the column headings/fields don't appear when I try. (The field headings of the cross tab query are likely to change based on the underlying select query parameters so I can't hard-code the field names).

So, any thoughts on how to reactivate my Menu once the user closes the crosstab query or else puts the focus on the database window? (I achieve this using vba code in the on_close events of other forms and reports but I don't see an equivalent option for queries!)

Please note that I'm a vba newbie!

Thanks,
Craig

View 5 Replies View Related

Update List Box Without Closing And Opening Ms Access

Aug 30, 2005

Greeting,
- i have a form, that has a List Box coming from a table ,,
This list box when you click on it, it shows that field in the main form
- and i have a front end and a backend to this database,
- When i add a new entry in my main form, it shows in the List Box just fine, but when i click on that list box, it doesn't show the entry on anyone else on the network - works ok locally

here is an eg: my main table has firstName, LastName, PhoneNumber, Address

Form : main form has firstName, LastName, PhoneNumber, Address
List Box inside my Form has: First Name

so i when i click on the firstName in my list box, it will show me the contact person in my main form

as i mentioned i have couple of people has the database open (split Database) anyone on the network, could see the update on the list box , but when they click on the new created name doesn't show in the main form, unless you close access, and reopen it again


i hope i was clear expaling,

any idea on how to have the List Box update itself without closing and opening Ms Access ??

thanks in advance

View 3 Replies View Related

Modules & VBA :: Navigation Pane Opening / Closing

Dec 4, 2013

I have a user login form wherein my users authenticate their employeeid as well as their person PIN. If the user authenticates with a valid username/ password combination, then the employee id and the role (permissions) for that user are stored on the form and it is minimized to stay open. If the user that authenticates has "Admin" role then I want to unhide the navigation pane. For all other roles I want the navigation pane to remain hidden.

That said, the default setting in the database is for the navigation pane to remain hidden. I have a piece of code on the login form as follows:

Code:
If Me.role = "Admin" Then
DoCmd.SelectObject acTable, "NavigationPaneObject", True
DoCmd.RunCommand acCmdWindowUnhide
Else
Exit Sub
End If

This is successfully unhiding the navigation pane, but I'm getting the following error message and I don't know how to get it to go away."Run-time error '2544':

"Microsoft Access cannot find the NavigationPaneObject you referenced in the Object Name argument."The code is unhiding the navigation pane.

View 1 Replies View Related

Queries :: Opening Closing Balance / Show Today Movement In DB And CR

Apr 18, 2014

I want to perform in this query that Opening balance + Dr - Cr = Closing balance.And the next day my opening balance will equal to the date() -1 closing balance. And when todays movement DR and CR take changes it will also take affect on closing balance.Here I have two questions 1st is how can I built a qry that will make todays opening equal to last day closing . Can I have to built two queries or make another table that store last day closing then create relationship and again built a query that perform.

View 14 Replies View Related

Month

Sep 16, 2005

Hi,
I am a very new guy in access. One very simple question.
How can I give crieteria for to get a query result for month and year
ie. i know DATE() is for today
between[start date]and [end date] gets from a date to a date
but i wanted to get particular month and year. How to write this?
Hope somebody will help in this matter.
thx and regards
nowfal

View 5 Replies View Related

Last Day Of Month - How Do You Do It?

Apr 11, 2007

I need to return the last date of the month not for this month, but 6 months down the road. When the FAA says 6 calendar months from a certain date it would mean go 6 months forward and then to the end of the month. So with today being April 11th, I would count 6 months forward to October, and then to the end of the month - October 31. Which would be the date I wish to return. I didn't see anything as far as formatting goes that would allow it to be done easily, and I've already attacked it two different ways, but I am wondering how you might solve the problem.

No rush in this. And I'm going to choke myself if I missed something very simple somewhere.

View 2 Replies View Related

Month Value

Jan 11, 2006

Hi All, HAPPY NEW YEAR!

I have a 2 fields, one is start date in the format dd,mm,yyyy - the other is end date in the same format. I want to create a field in my query called "month" which will give the month for any record. This will be a parameter field.

So that when I type in January in my parameter - I will see all the records for that month. How can this be done?

View 3 Replies View Related

Last Month

Mar 30, 2006

Hello,

I have a query which pulls data based on a date range.
However, instead of using this, I'd like to only get data for last month.

I have tried doing this by adding 2 fields :

Month: Month(myDate)

and

Year : Year(myDate)
In each of these fields I have added a criteria of :

Month(Date())-1

and

Year(Date())

This allows me to get the data for last month (say February), but also ensures it is only the data for this year. (as the DB holds data for the past 4 or 5 years)

The problem is though, when the year rolls over to January, this will not work.

Can anyone shed any light on an alternative please ?

Thanks,

J.

View 5 Replies View Related

Automatic Month

May 9, 2005

auto date no problem but just an automatic month ??


any ideas???

View 4 Replies View Related

Name Of The Month In English

Jun 23, 2005

My problem: I work on a German machine (i.e. the regional settings are set for Germany) but have created reports in Access where the name of the month needs to appear in English. Is there a way to do this without monkeying with the regional settings?

Thanks in advance...

View 7 Replies View Related

2 Digit Month

Jan 4, 2006

Hi,

How can I get a 2 digit month when I use month(now())? I've getting only 1 instead of 01. Please advise.

View 1 Replies View Related

Store Month Only

Jan 9, 2006

if you are asked to store only the month, or only the month and year, how do you do it? tnx.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved