Results 1 to 5 of 5
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    controll date in entry.... (2000 sr-1)

    how to controll if the user insert a date in textbox3 is before label62 and if date in textbox4 is after label63?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: controll date in entry.... (2000 sr-1)

    Try

    If CDate(Me.TextBox3) < CDate(Me.Label62) Then
    ...
    End If

    If CDate(Me.TextBox4) > CDate(Me.Label63) Then
    ...
    End If

  3. #3
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: controll date in entry.... (2000 sr-1)

    I think you know the answer to this one!

    If me.txbox3.value<me.label 62.value then

    me.textbox3.value=""
    me.textbox4.value=""

    msgbox "The date must be after this"

    else

    end if

    Put in the after update event of the text box

    Do the same for the other, just change the code
    Jerry

  4. #4
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: controll date in entry.... (2000 sr-1)

    Nice <img src=/S/king.gif border=0 alt=king width=21 height=22> <img src=/S/whisper.gif border=0 alt=whisper width=29 height=17> ...

    wath you think:
    If CDate(Me.TextBox3) < CDate(Me.Label62) Then
    MsgBox ("PRIMA DATA DISPONIBILE " & Me.Label62.Caption & " INSERIRE UNA DATA VALIDA"), vbCritical
    Me.TextBox3 = ""
    Me.TextBox3.SetFocus
    Exit Sub
    End If

    If CDate(Me.TextBox4) > CDate(Me.Label63) Then
    MsgBox ("ULTIMA DATA DISPONIBILE " & Me.Label63.Caption & " INSERIRE UNA DATA VALIDA"), vbCritical
    Me.TextBox3 = ""
    Me.TextBox4.SetFocus
    Exit Sub

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: controll date in entry.... (2000 sr-1)

    That should work.

    (Personally, I wouldn't clear the text boxes. If the user made only a small mistake, it is easier to edit the value than to have to start over)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •