AboutRichard Rost Expertise I can answer any questions pertaining to Microsoft Visual Basic 6.0, Microsoft Access VBA, and the Visual Basic Language in general. I do NOT use VB.NET or VB 2005/08 much yet, so don't ask me any questions specific to those. Also, please feel free to check the Tips & Tricks section of my web site for VB tips.
Education/Credentials I am a self-taught VB expert. I have been building software for clients since the early 90s (and on my own since I was a child). You can see a sample of my Tutorials on my web site at 599CD.com
Expert: Richard Rost Date: 6/20/2008 Subject: Finding difference between to dates
Question dear Sir,
I have two fields in a (vb 6)form such as IssueDate and ExpiryDate.it store data from the database.i want to format the ExpiryDate text box that, while the difference between above two field will be <365and >300 days.i stored the date format as "dd-mmm-yy" in the database. How can i calculate the difference between these two dates in days. please suggest me to get the solution .i shall be grateful to you.
Answer You'll have to change your dates to a format that VB understands, like mm/dd/yy. Once you've done that, you can convert the text value to a DATE value using the CDate() function. Then, it's just a matter of subtracting the values to figure the number of days.
Let me know if you have any other questions or comments.
P.P.S. I volunteer my time at AllExperts to help people, and I get a LOT of questions, so I can't take an hour to answer each question. If you need more DETAILED HELP, come to my TechHelp web site at http://www.599cd.com/TechHelp/AllExperts and I'll take as much time as you need to answer your question.