473,803 Members | 2,792 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

date parameter

i got date parameter but it shows only 2007 records and not for other
year and would like to know where i have writte code wrong it shows
month only from 1/3/2007 to 2/4/2007 not able to figureout y.
Option Compare Database
Private Sub cmdMonth_Click( )
Public Function fncFirstofMonth (dtmDate As Date) As Date

Dim dtmResult As Date
fncFirstofMonth = DateSerial(Year (dtmDate), Month(dtmDate), 1)

End Sub
Public Function fncLastofMonth( dtmDate As Date) As Date

Dim dtmResult As Date
dtmResult = fncFirstofMonth (dtmDate)
dtmResult = DateAdd("d", -1, DateAdd("m", 1, dtmResult))
fncLastofMonth = dtmResult

End Sub

Private Sub cmdtoday_Click( )
'sets the Date From and Date To text boxes
'to Today's Date

Me!txtDateFrom = Date
Me!txtDateTo = Date

End Sub
Private Sub cmdweek_Click()
'sets the Date From and Date To text boxes
'to show complete working week (mon - fri)

Dim today

today = Weekday(Date)

Me!txtDateFrom = DateAdd("d", (today * -1) + 2, Date)
Me!txtDateTo = DateAdd("d", 6 - today, Date)

End Sub
Private Sub cmdyear_Click()
'Sets the Date From and Date To text boxes
'to show complete current year

Me!txtDateFrom = CDate("01/01/" & Year(Date))
Me!txtDateTo = DateAdd("d", -1, DateAdd("yyyy", 1, Me!
txtDateFrom))

End Sub
Private Sub cmdReport_Click ()
On Error GoTo Err_cmdReport_C lick

Dim stDocName As String

stDocName = "rptDateParamet erReport"

'Check values are entered into Date From and Date To text boxes
'if so run report or cancel request

If Len(Me.txtDateF rom & vbNullString) = 0 Or Len(Me.txtDateT o &
vbNullString) = 0 Then
MsgBox "Please ensure that a report date range is entered into
the form", _
vbInformation, "Required Data..."
Exit Sub
Else
DoCmd.OpenRepor t stDocName, acPreview
End If
Exit_cmdReport_ Click:
Exit Sub

Err_cmdReport_C lick:
MsgBox Err.Description
Resume Exit_cmdReport_ Click

End Sub

Apr 12 '07 #1
1 2486
On Apr 12, 7:43 pm, bhav...@gmail.c om wrote:
i got date parameter but it shows only 2007 records and not for other
year and would like to know where i have writte code wrong it shows
month only from 1/3/2007 to 2/4/2007 not able to figureout y.
Option Compare Database
Private Sub cmdMonth_Click( )
Public Function fncFirstofMonth (dtmDate As Date) As Date

Dim dtmResult As Date
fncFirstofMonth = DateSerial(Year (dtmDate), Month(dtmDate), 1)

End Sub
Public Function fncLastofMonth( dtmDate As Date) As Date

Dim dtmResult As Date
dtmResult = fncFirstofMonth (dtmDate)
dtmResult = DateAdd("d", -1, DateAdd("m", 1, dtmResult))
fncLastofMonth = dtmResult

End Sub

Private Sub cmdtoday_Click( )
'sets the Date From and Date To text boxes
'to Today's Date

Me!txtDateFrom = Date
Me!txtDateTo = Date

End Sub

Private Sub cmdweek_Click()
'sets the Date From and Date To text boxes
'to show complete working week (mon - fri)

Dim today

today = Weekday(Date)

Me!txtDateFrom = DateAdd("d", (today * -1) + 2, Date)
Me!txtDateTo = DateAdd("d", 6 - today, Date)

End Sub

Private Sub cmdyear_Click()
'Sets the Date From and Date To text boxes
'to show complete current year

Me!txtDateFrom = CDate("01/01/" & Year(Date))
Me!txtDateTo = DateAdd("d", -1, DateAdd("yyyy", 1, Me!
txtDateFrom))

End Sub
Private Sub cmdReport_Click ()
On Error GoTo Err_cmdReport_C lick

Dim stDocName As String

stDocName = "rptDateParamet erReport"

'Check values are entered into Date From and Date To text boxes
'if so run report or cancel request

If Len(Me.txtDateF rom & vbNullString) = 0 Or Len(Me.txtDateT o &
vbNullString) = 0 Then
MsgBox "Please ensure that a report date range is entered into
the form", _
vbInformation, "Required Data..."
Exit Sub
Else
DoCmd.OpenRepor t stDocName, acPreview

Exit_cmdReport_ Click:
Exit Sub

Err_cmdReport_C lick:
MsgBox Err.Description
Resume Exit_cmdReport_ Click

End Sub
I figured out the erroe sorry for wasting your time

Apr 13 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3736
by: Dominique Javet | last post by:
Hello, I'm new to php and mysql and I use Dreamweaver MX 2004, so sorry for this "newbie" question... I've found no answer in the forum ... I've a date problem with my formular. In my mysql DB my filed "date" in table "experience" is like this: Y-m-d (2002-07-23). My fied`date` is date, NOT NULL with no default entry My form read well the date data depending the id, (pe. 30.02.2003), but when I submit a new date, I receive as result...
4
4483
by: Tony | last post by:
Hey guys, I use Google Groups quite a bit as it is an enormous wealth of information, and now I need some help. I have created a query using parameters to capture a range of date, the date is also formatted. test: Format(,"mm/dd/yy") Between And
10
11972
by: John Morgan | last post by:
Does anyone know what parameter should be used instead of Date = 0 for the optional parameter in the following function? Public Function dhAge(ByVal dtmBD As Date, Optional ByVal dtmDate As Date = 0) As Short
11
1905
by: Lauren Quantrell | last post by:
I already figured out (the hard way) I need to convert all my date parameters into USA format before executing my stored procedures where dates are used as parameters. (Format(StartDate, "m/d/yyyy hh:nn:ss AM/PM") At least I thought I did! But then I discover that if I use the following construction, the dates do not need to be formatted to USA first:
12
2613
by: Rob Meade | last post by:
Hi all, Ok - I've come from a 1.1 background - and previously I've never had any problem with doing this: Response.Write (Session("MyDate").ToString("dd/MM/yyyy")) So, I might get this for example: 21/05/2006
2
14005
by: sixdeuce62 | last post by:
Hello, I am trying to create a query that will prompt me to enter the parameter value if beginning date and ending date. I have created everything I need in the query, but I have to manually go into SQL view to change the date range. This is what I have so far: TRANSFORM Count(.ID) AS CountOfID SELECT ., Count(.ID) AS FROM
7
4268
by: =?Utf-8?B?U3R1?= | last post by:
I have a ASP.NET Ajax app (using client library) calling ASP.NET Ajax-enabled web services. We are making use of the javascript proxies generated by ASP.NET Ajax. The problem we have is that the UTC dates sent by the browser are being adjusted for timezones by the server, but we do not want dates adjusted for timezones. For example, the user enters the date of a transaction as '25 May 2007'. That ends up as a javascript Date()...
4
3454
by: davide507 | last post by:
Hello, I've created a select query with a date range parameter as well as a text field parameter Between and The second parameter: Like or Like Is Null. When you run the query, and enter the range and the Accountant's name, it returns the accountants records for the specified date range. When you enter the date range and leave the accountant parameter blank, it returns all records regardless of the date range entered. How do I...
0
3692
by: jans78 | last post by:
Appreciate if you all can help me to solve my Crystal Report problems First, I create some parameters and one of the parameters is Date. I set the parameter for the date is String. For example : parameter 1 - From Collection Date parameter 2 - To Collection Date I should display the results base on this selection criteria : 1) specific date - to enter specific date in FROM and TO field eg 20071227 to 20071227 2) greater or equal date -...
2
2130
by: Kerryn | last post by:
Hi all new to this site so looking for some help. I am working in Access 2002, using a select query. I am trying to use a date range parameter to allow the users to end the start date and end date i.e 1/1/08 and 31/1/08, the field name is Transaction Date and some dates have timestamps and some dont. Parameter >= And <= When entering the last date the query, if the transaction date record has a time stamp of 31/1/08 10:23 this is not...
0
9565
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10317
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10295
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9125
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7604
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6844
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4275
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
2
3799
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2972
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.