Hi folks,
In My Application i have used the date function to find the difference between two date.but while executing is showing that runtime erroe 424,object required.
Can anyone plz help me fast...

This is the code i have used

Dim date1, date2 As Date
Dim diff As Long
date1 = CDate(txtDOB.Text)
date2 = Date
diff = DateDiff(DateInterval.Month, date2, date1)
MsgBox diff

plz send the answer in my email also:jithusit@gmail.com

Recommended Answers

All 2 Replies

Hi folks,
In My Application i have used the date function to find the difference between two date.but while executing is showing that runtime erroe 424,object required.
Can anyone plz help me fast...

This is the code i have used

Dim date1, date2 As Date
Dim diff As Long
date1 = CDate(txtDOB.Text)
date2 = Date
diff = DateDiff(DateInterval.Month, date2, date1)
MsgBox diff

plz send the answer in my email also:jithusit@gmail.com

DateInterval.Month is for Vb.Net
FOr VB use
diff = DateDiff("m", date2, date1)

DateInterval.Month is for Vb.Net
FOr VB use
diff = DateDiff("m", date2, date1)

Yes, agreed.
Just post code for vb 6 in this section friend :), cause there are section for vb.net

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.