PC Review


Reply
Thread Tools Rate Thread

Getting Fields to come out as date

 
 
=?Utf-8?B?S291IFZhbmc=?=
Guest
Posts: n/a
 
      17th Mar 2006
I have 2 fields, a date and a time. How do I get them into the CDbl( )
formula? The CDbl wants it to be: CDbl(#date#). I keep getting type
mismatch when I try to use my value in my textbox. So I want to get this:

txtDate = 11/1/2005
txtTime= 2:00:00 PM

CDbl(txtDate & txtTime)= numeric value from date and time

But I can't get the Date and Time into a correct format to use the formulas.
Thanks!
 
Reply With Quote
 
 
 
 
Dirk Goldgar
Guest
Posts: n/a
 
      17th Mar 2006
"Kou Vang" <(E-Mail Removed)> wrote in message
news:0612E285-43E7-4F60-B8C9-(E-Mail Removed)
> I have 2 fields, a date and a time. How do I get them into the CDbl(
> ) formula? The CDbl wants it to be: CDbl(#date#). I keep getting
> type mismatch when I try to use my value in my textbox. So I want to
> get this:
>
> txtDate = 11/1/2005
> txtTime= 2:00:00 PM
>
> CDbl(txtDate & txtTime)= numeric value from date and time
>
> But I can't get the Date and Time into a correct format to use the
> formulas. Thanks!


Are txtDate and txtTime text fields? If so, you'll have to convert them
into Date fields first. You could do this:

x = CDbl(CDate(txtDate & " " & txtTime))

or this:

x = CDbl(CDate(txtDate) + CDate(txtTime))

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


 
Reply With Quote
 
=?Utf-8?B?S291IFZhbmc=?=
Guest
Posts: n/a
 
      17th Mar 2006
They are Date fields, and I finally figured it out. Thanks!

"Dirk Goldgar" wrote:

> "Kou Vang" <(E-Mail Removed)> wrote in message
> news:0612E285-43E7-4F60-B8C9-(E-Mail Removed)
> > I have 2 fields, a date and a time. How do I get them into the CDbl(
> > ) formula? The CDbl wants it to be: CDbl(#date#). I keep getting
> > type mismatch when I try to use my value in my textbox. So I want to
> > get this:
> >
> > txtDate = 11/1/2005
> > txtTime= 2:00:00 PM
> >
> > CDbl(txtDate & txtTime)= numeric value from date and time
> >
> > But I can't get the Date and Time into a correct format to use the
> > formulas. Thanks!

>
> Are txtDate and txtTime text fields? If so, you'll have to convert them
> into Date fields first. You could do this:
>
> x = CDbl(CDate(txtDate & " " & txtTime))
>
> or this:
>
> x = CDbl(CDate(txtDate) + CDate(txtTime))
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel SHOULD NOT AUTO-CHANGE formated text fields to DATE FIELDS! =?Utf-8?B?UFNTU0Q=?= Microsoft Excel Worksheet Functions 2 8th Aug 2006 10:31 PM
syntax for combining text fields and formatted date fields; =?Utf-8?B?ZGlyb3M=?= Microsoft Access Queries 1 5th Oct 2005 02:15 PM
Text fields changed to date fields =?Utf-8?B?Z3Vpbm5lc3M0YnJlYWtmYXN0?= Microsoft Excel Misc 4 17th Nov 2004 03:50 AM
Trouble with Find method locating Date fields - works great with String fields. Marcel K. Microsoft Excel Worksheet Functions 0 8th Jan 2004 09:44 PM
Date fields automatically changing when today date matches date field entry.Help! Brian Cassin Microsoft Access Forms 1 15th Nov 2003 02:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:40 PM.