Robin-
Perhaps put code like this in the form's BeforeUpdate event:
Private Sub Form_BeforeUpdate(Cancel as Integer)
' If on a new record
If Me.NewRecord Then
' If today is after July 1,
If Date > DateSerial(Year(Date), 7, 1) Then
' Use July 1 of next year
Me.NextFiscalYear = DateSerial(Year(Date) + 1, 7, 1)
Else
' Use July 1 of this year
Me.NextFiscalYear = DateSerial(Year(Date), 7, 1)
End If
End If
End Sub
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Robin Chapple
Sent: Thursday, March 14, 2013 11:11 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: RE: [MS_AccessPros] How do I establish the first day of "Next
Fiscal Year"
Thanks John,
The form is on a remote server.
Our next fiscal year is 1/7/2013 -30/6/2014.
I need the query to add 1/7/2013 by default when anyone adds a new name.
Many thanks,
Robin
At 14/03/2013 06:18 PM, you wrote:
>Robin-
>
>
>
>Are you saying that July 1 of this year starts fiscal year 2014? What does
>the user enter in "Next Fiscal Year" (I assume this is in a form), and what
>do you expect to happen?
>
>
>
>John Viescas, Author
>
>Microsoft Access 2010 Inside Out
>
>Microsoft Access 2007 Inside Out
>
>Microsoft Access 2003 Inside Out
>
>Building Microsoft Access Applications
>
>SQL Queries for Mere Mortals
>
>http://www.viescas.com/
>
>(Paris, France)
>
>
>
>
>
>
>
>From: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
>[mailto:MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com> ] On Behalf Of Robin
Chapple
>Sent: Thursday, March 14, 2013 7:25 AM
>To: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
>Subject: [MS_AccessPros] How do I establish the first day of "Next Fiscal
>Year"
>
>
>
>
>
>My organisation has a fiscal year that starts on 1st July.
>
>I need the SQL for a query that will enter 1/7/'nextfiscalyear' when
>we enter names for committees and other posts in the 'Next Fiscal Year'.
>
>It has completely baffled me. That is not difficult as some of you
>know already.
>
>Many thanks,
>
>Robin Chapple
>
>
>
>
>
>[Non-text portions of this message have been removed]
>
>
>
>------------------------------------
>
>Yahoo! Groups Links
>
>
>
[Non-text portions of this message have been removed]
| Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (4) |
Tidak ada komentar:
Posting Komentar