|
-
Feb 27th, 2007, 08:38 AM
#1
Thread Starter
Lively Member
[RESOLVED] Help in MS SQL 7....Date
hi,
in Text1 i'll b giving Year.
in Text2 i'll b giving month(in number format.eg: 02 - Feb.)
when Text3 gets Focus, i need 28/02/2007. (Last date for the month entered in "dd/mm/yyyy" format).
i need this using MS SQL 7.
 Preethi. 
-
Feb 27th, 2007, 09:18 AM
#2
Re: Help in MS SQL 7....Date
First, don't use Text1, Text2 and Text3. Give them names that will be meaningful. Try this:
Code:
Option Explicit
Private Function FindLastDayOfMonth(ByVal iMonth As Integer, ByVal iYear _
As Integer) As Integer
Dim dtTemp As Date
dtTemp = DateSerial(iYear, iMonth, 1)
FindLastDayOfMonth = DateAdd("M", 1, dtTemp) - dtTemp
End Function
Private Sub Command1_Click()
Dim i As Integer
i = FindLastDayOfMonth(Val(txtMonth.Text), Val(txtYear.Text))
txtLastDay.Text = txtMonth.Text & "/" & i & "/" & txtYear.Text
End Sub
-
Feb 27th, 2007, 10:19 AM
#3
Thread Starter
Lively Member
Re: Help in MS SQL 7....Date
Thanx Hack.
in my project, i am using correspnding text boxes name only.
jz for asking doubts in Forum,i'm using Text1, Text2, ...........
 Preethi. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|