473,569 Members | 2,768 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.viewreport s 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 2079
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(Yea r(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
17383
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 query with select mid(tblTable.FieldName,1,10)should look something like select substring(tblTable.FieldName,1,10). This is really the simplest of...
9
1897
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 dates such as 1/8/05 being interpreted in the wrong way. I have been given many suggestions (setting LCID, submitting dates in long format etc....
3
3410
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 working on. I am working with MS Access 2002. And I am having a problem with one of my charts. I will explain how everything is laid out then go...
17
4394
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 there, but is there a way they can find out if that application was put there from a CD or email or created at work? Hint: It's not on a client/server...
5
2548
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 #31/1/2006#" But when I try it from my vb.net app, I get ALL the records in the tabel?? What goes wrong? I haven't been able to find any info on the net,...
5
3153
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 tables in it. One of my forms has two TEXT BOX controls formated as Short Date. The form is binded to a linked table. The linked tables has about 7...
2
5151
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 so many problems .... first of all i try access with uk settings in date/time in field but access changes date after 09/11 to 11/09 i don't know...
9
5723
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 field is printed within the detailed area. The problem is, the apllication is not setup properly, thus the users are entering data within the memo...
1
9762
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 having I'd be most appreciative. The database is already constructed, I'm just wanting to export the data to an excel file. In short, I'm hoping...
3
8631
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 than 1 May 2007. Colm
0
7694
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...
0
8118
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...
1
7666
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...
0
6278
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...
1
5504
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...
0
3651
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.