Results 1 to 3 of 3

Thread: [RESOLVED] Help in MS SQL 7....Date

  1. #1

    Thread Starter
    Lively Member preethi_rjs's Avatar
    Join Date
    Dec 2006
    Posts
    80

    Resolved [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.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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

  3. #3

    Thread Starter
    Lively Member preethi_rjs's Avatar
    Join Date
    Dec 2006
    Posts
    80

    Thumbs up 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
  •  



Click Here to Expand Forum to Full Width