473,432 Members | 1,519 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,432 software developers and data experts.

MS Access VBA - Dates

29
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 2053
missinglinq
3,532 Expert 2GB
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
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 Expert 2GB
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
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
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
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
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
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
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
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
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
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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...
0
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...
0
tracyyun
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...
0
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,...
0
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.