-
Hello VB programmers,
In my program I do have to find out or a field (format Date) is greater then a string date:
Field Paid is format Date
source:
Private Sub Form_Load()
Dim DB As Database
Dim RS As Recordset
Dim DT As String
DT = "3/1/00"
Set DB = OpenDatabase("c:\q.mdb")
Set RS = DB.OpenRecordset("select * from SubScribers")
If RS!PaidThrough > DT Then
q = q
Else
q = q
End If
End Sub
When the value of PaidThrough = 1/3/99 the field is allway greater then DT.
Is there any possibility to convert a string to a date to get a correct answer.
Nice regards,
Michelle.
-
Declare DT as a date, not a string
when you set it set it with
DT=#3/1/99#
Hope this helps
-
You can convert a string to a date with the CDate function
Code:
Dim sDate as String
sDate = "02-01-2000"
If CDate(sdate) > "01-01-2000" Then
Debug.Print "Yes, the date is higher"
Else
Debug.Print "No, the date is not higher"
End if
-Kayoca Mortation
-
You can convert a string to a date with the CDate function
Code:
Dim sDate as String
sDate = "02-01-2000"
If CDate(sdate) > "01-01-2000" Then
Debug.Print "Yes, the date is higher"
Else
Debug.Print "No, the date is not higher"
End if
-Kayoca Mortation
-
You can convert a string to a date with the CDate function
Code:
Dim sDate as String
sDate = "02-01-2000"
If CDate(sdate) > "01-01-2000" Then
Debug.Print "Yes, the date is higher"
Else
Debug.Print "No, the date is not higher"
End if
-Kayoca Mortation
-
You can convert a string to a date with the CDate function
Code:
Dim sDate as String
sDate = "02-01-2000"
If CDate(sdate) > "01-01-2000" Then
Debug.Print "Yes, the date is higher"
Else
Debug.Print "No, the date is not higher"
End if
-Kayoca Mortation
-
You can convert a string to a date with the CDate function
Code:
Dim sDate as String
sDate = "02-01-2000"
If CDate(sdate) > "01-01-2000" Then
Debug.Print "Yes, the date is higher"
Else
Debug.Print "No, the date is not higher"
End if
-Kayoca Mortation
-
Sorry, I hat a system hangup. i have pressed to much the buttons....
-Kayoca Mortation
-
Hi, kayoca.
You (and only you) can delete your duplicates clicking on "edit/delete".