473,503 Members | 2,435 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MS Access VBA - Dates

29 New Member
I got another problem while working on this database for the Univ.

The Form.viewreports has several radial button options so that the user can
view a Report for several periods--like a day, a week, a month, etc. The frame is linked to a select case statement.

The user is also able to choose the radial button options: "fiscal year" and "fiscal year-to-date" reports. The fiscal year for the univ. starts on July 1st.

The Query that sends the data to the Report for a user to view has two parameters called "bgndate" and "enddate" which are both linked to fields on the Forms![viewreport] which I am currently working.

So, Forms![viewreports]![bgndate] and Forms![viewreports]![enddate] are available for the user to define.

Question: How in the heck, do I set the [bgndate] on the Form![viewreport]
to the beginning of the fiscal year -- July 1st (current year)

--shiznaw
Jun 17 '07 #1
3 2064
missinglinq
3,532 Recognized Expert Specialist
If you're asking how to set add the current year to July1, then something like this should work:

bgndate = "07/01/" & datepart("yyyy",Date)
Jun 17 '07 #2
shiznaw
29 New Member
I think I got it: How to establish the Fiscal Year-to-Date Parameter in VBA

Dim fscldate as Variant
----------------------------------------------------------------------------------------
If Date < Format("08/01/" & Year(Now)) Then
fscldate = Format("08/01/" & Year(Now) - 1)
Else
fscldate = Format("08/01/" & Year(Now) - 1)
End If
----------------------------------------------------------------------------------------
[reprtform]![Beginning] = fscldate
[reprtform]![ending] = DateSerial(Year(Now()), Month(Now()), Day(Now()))
msgbox ("From Date: " & [Beginning] & " " & "To Date: " & [ending])

the above works. Please critique
thanxs
shiznaw, scripts village idiot
Jun 17 '07 #3
FishVal
2,653 Recognized Expert Specialist
I think I got it: How to establish the Fiscal Year-to-Date Parameter in VBA

Dim fscldate as Variant
----------------------------------------------------------------------------------------
If Date < Format("08/01/" & Year(Now)) Then
fscldate = Format("08/01/" & Year(Now) - 1)
Else
fscldate = Format("08/01/" & Year(Now) - 1)
End If
----------------------------------------------------------------------------------------
[reprtform]![Beginning] = fscldate
[reprtform]![ending] = DateSerial(Year(Now()), Month(Now()), Day(Now()))
msgbox ("From Date: " & [Beginning] & " " & "To Date: " & [ending])

the above works. Please critique
thanxs
shiznaw, scripts village idiot
Nice!
But of course not the only way.
Here is my solution.

=DateSerial(Year(DateAdd("m", -7, [YourDate])), 8, 1)

How do you like it?
Jun 17 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
17373
by: Dana Shields | last post by:
I am attempting to upsize from access to SQL Server. I'm trying to convert my queries to SQL Server views; however, I'm having a lot of difficulty with the syntax differences. For instance, a...
9
1891
by: Neil | last post by:
I have been coding with ASP for some time now. I am using an ACCESS database. I am in the UK and wish to use DD/MM/YYYY format for dates. I have had no end of problems and possible solutions to...
3
3397
by: StBond | last post by:
Hi everyone, I am new to Access and Visual Basic so things my be getting across a bit cloudy. I only started using VB for one week. I am having a little problem with the database that I am...
17
4382
by: Mell via AccessMonster.com | last post by:
Is there a way to find out where an application was created from? i.e. - work or home i.e. - if application sits on a (work) server/network, the IT people know the application is sitting...
5
2541
by: Henning M | last post by:
Hi all, I having some problems with Access and selecting records between dates.. When I try this in access, it works fine!! "Select * from Bilag Where Mdates Between #1/1/2006# And...
5
3147
by: Easystart | last post by:
Hi, Sorry for my English. English is not my native tougue. I am working in MS Access 2000 with a SQLServer 2000 Backend database. MS Access 2000 is my GUI front end that has SQLServer linked...
2
5141
by: hardik | last post by:
hi friends, i am really surprized the way access behaves in date fields i mean it's all ok when you have us time zone or us servers but if you have diffrent timezone like uk then access creates...
9
5718
by: RMC | last post by:
Hello, I'm looking for a way to parse/format a memo field within a report. The Access 2000 database (application) has an equipment table that holds a memo field. Within the report, the memo...
1
9753
by: smaczylo | last post by:
Hello, I've recently been asked to work with Microsoft Access, and while I feel quite comfortable with Excel, I'm at a complete loss with databases. If someone could help me with this issue I'm...
3
8620
by: colmkav | last post by:
Hi, can someone tell me how I change the settings in my Access 97 to default to English dates rather than US dates? I notice all my dates like 1/5/2007 is being treated as 5th Jan 2007 rather...
0
7188
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
7313
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...
1
6970
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...
1
4987
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...
0
4663
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...
0
3156
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3146
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
366
bsmnconsultancy
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...

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.