I'm writing an application that stores some user data, one of the items is an expiry date entered into a text box in the UK format (dd/mm/yy).

Before I store this in the Access DB I'm trying to convert it to a date (as it's a string when it's entered).

If I enter the date 22/10/05 and then call CDATE(txtExpiryDate.Text) I get the following error.

Cast from string "22/10/04" to type 'Date' is not valid

I'm assuming it's because it's expecting the US format, the question is how do I convert a string in the UK format to a date I can store in Access ?

I want it as a date because later in the application I want to compare it against todays date to check whats expired.

Hope this makes sense.