A text box show current date(like 24-03-2009). I write in other textbox
3. I want when I write 3 then the textbox (24-03-2009) automatically increase month like 24-06-2009. how it possible?

Recommended Answers

All 10 Replies

' Use the Change Event of the text box
Private Sub txtDateChange_Change()
    Dim strText, vNewDate As Variant, intEntered As Integer
    strText = txtDateChange
    
If IsNumeric(strText) Then
        intEntered = CInt(strText)
        vNewDate = DateAdd("m", intEntered, CDate(txtDate1))
        txtDate1 = Format(vNewDate, "Short Date")
    End if
End Sub
' Use the Change Event of the text box
' In this example txtDateChange is the other text box.
Private Sub txtDateChange_Change()
    Dim strText, vNewDate As Variant, intEntered As Integer
    strText = txtDateChange
    ' Test for correct input: this does not deal with negative values.
    If IsNumeric(strText) Then
        intEntered = CInt(strText)
        ' Use the DateAdd Function: 
        vNewDate = DateAdd("m", intEntered, CDate(txtDate1))
        ' Enter the new date in your text box with the date         
         txtDate1 = Format(vNewDate, "Short Date")
    End if
End Sub

its not work. I do it like : I write this code in that text box where I want to enter 3. and the other textbox show (when from load) date 24-03-2009. I don't understand what probleM? please tell me ...

please tell me ...

The thread has been marked solved. I guess you figured it out?

every thing is ok. thanks

A text box show current date(like 24-03-2009). I write in other textbox
3. I want when I write 3 then the textbox (24-03-2009) automatically increase month like 24-06-2009. how it possible?

Text1.Text = Format(DateAdd("m", Val(Text2.Text), Text1.Text), "dd-mm-yyyy")

Private Sub Command1_Click()
Dim Sum As Integer
Mon = Month(Now)

Set rsStu1 = New ADODB.Recordset
Str_Stu1 = "select* from Cloth_Issue_Note_off where ItemName like '" & cboItem.Text & "' And ItemActive=1"
rsStu1.Open Str_Stu1, cnnNSDClothing, adOpenStatic, adLockOptimistic, adCmdText

rsStu1.MoveFirst
MsgBox "Test " & DateDiff("M", rsStu1!Date_Of_Issue, Now)

Sum = 0

While rsStu1.EOF = False
Sum = Sum + Val(rsStu1!Item_Qty)
Wend

MsgBox "" & Sum

End Sub

Here shown a error that is "overflow" but I cannot understand how it is overflow. When I put my cursor on the sum variable then show that it's value is 32766. What is the solution, how can I increase my variable in VB6.

Thank you,
Tara bosh
tara.bosh@yahoo.com

You have declard your variable as integer, which max amount it holds is 32767. Try as Long or as Double. See help on variables for more information...

Good Luck

how can i increase the date in php(4 version)
please help me

you need to apply a new thread.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.