Get Date Range With DatePicker on Visualbasic6
'Made on 4th June 2009 BY Muh. Iqbal oo>LABQ5oo<
Private Sub DTPEntered_Change()
TxtDateEntered.Text = DTPEntered.Value
End Sub
Private Sub DTPEntered_Click()
TxtDateEntered.Text = DTPEntered.Value
End Sub
Private Sub DTPReturn_Change()
TxtDateReturn.Text = DTPReturn.Value
SQLQuery
End Sub
Private Sub DTPReturn_Click()
TxtDateReturn.Text = DTPReturn.Value
SQLQuery
End Sub
Private Sub TxtDateEntered_Change()
If DTPEntered.Value > DTPReturn.Value Then
MsgBox "Date entered must be less than or " & vbCrLf & _
"equal to the date of return",vbExclamation
DTPReturn.Value = DTPEntered.Value
End If
End Sub
Private Sub TxtDateReturn_Change()
If DTPReturn.Value < DTPEntered.Value Then
MsgBox "Date of return must be more or " & vbCrLf & _
"equal to the date of entry",vbExclamation
DTPEntered.Value = DTPReturn.Value
End If
End Sub
'Query is Used
Sub SQLQuery()
Dim RSZZ As New ADODB.Recordset
Dim SQLz As String
MySql= "SELECT * FROM WHERE DailyReport_Tab.DateEntered >= #" & TxtDateEntered.Text & "#
And DailyReport_Tab.Return <= #" & TxtDateReturn.Text & "#"
RSDailyReport.Open MySqL, Conn, adOpenKeyset, adLockOptimistic
End Sub
Private Sub DTPEntered_Change()
TxtDateEntered.Text = DTPEntered.Value
End Sub
Private Sub DTPEntered_Click()
TxtDateEntered.Text = DTPEntered.Value
End Sub
Private Sub DTPReturn_Change()
TxtDateReturn.Text = DTPReturn.Value
SQLQuery
End Sub
Private Sub DTPReturn_Click()
TxtDateReturn.Text = DTPReturn.Value
SQLQuery
End Sub
Private Sub TxtDateEntered_Change()
If DTPEntered.Value > DTPReturn.Value Then
MsgBox "Date entered must be less than or " & vbCrLf & _
"equal to the date of return",vbExclamation
DTPReturn.Value = DTPEntered.Value
End If
End Sub
Private Sub TxtDateReturn_Change()
If DTPReturn.Value < DTPEntered.Value Then
MsgBox "Date of return must be more or " & vbCrLf & _
"equal to the date of entry",vbExclamation
DTPEntered.Value = DTPReturn.Value
End If
End Sub
'Query is Used
Sub SQLQuery()
Dim RSZZ As New ADODB.Recordset
Dim SQLz As String
MySql= "SELECT * FROM WHERE DailyReport_Tab.DateEntered >= #" & TxtDateEntered.Text & "#
And DailyReport_Tab.Return <= #" & TxtDateReturn.Text & "#"
RSDailyReport.Open MySqL, Conn, adOpenKeyset, adLockOptimistic
End Sub
Komentar
Posting Komentar