Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CDate ???

Status
Not open for further replies.

prija

Programmer
Oct 17, 2002
28
YU
I have one problem, in my application I have a lot of date field. All, are 'Text' box. When I convert that Text field in date, I recive a error. It look like this:

Private sub ...

Dim Datum1
.
.
.
Datum1=Format(CDate(txt_box1),"mm/dd/yy")
.
.
.

end

I recive a message:

Type mismatch

But, I don't say something. My application work a few months before this!!! Before four days, I reinstall my Windows 2000,VB6,SQL2000,... and from that time I recive this error.I check my regional setings, and date format is OK!
What is problem, I don't see!
Help me!
Thanks.
 
txt_box1 is a control; you need to access its Text property to get the contents. Either of these should work depending on whether you require the date as a string or a date value:

Dim Datum1 As Date
Datum1=CDate(txt_box1.Text)

Dim Datum1 As String
Datum1=Format$(txt_box1.Text),"mm/dd/yy")

Paul Bent
Northwind IT Systems
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top