PC Review


Reply
Thread Tools Rate Thread

Change a field type from data to date/time??

 
 
MarieG
Guest
Posts: n/a
 
      11th Jun 2009
I have a date format of 01/01/09 12:59:59 AM that I formatted to be
01/01/01. When I run the query, the 01/01/01 field is put into the table as
a text field.. this screws with my crosstab when I sort ascending...
Thoughts?
 
Reply With Quote
 
 
 
 
KARL DEWEY
Guest
Posts: n/a
 
      11th Jun 2009
>>I have a date format of 01/01/09 12:59:59 AM
Where is the above data at when you format it?

>>When I run the query, the 01/01/01 field is put into the table as a text field.

What kind of query is it? What is the data type of the field in the table?

Post the SQL of your query that puts it in the table. Open query in design
view, click on VIEW - SQL View, highlight all, copy, and paste in a post.

"MarieG" wrote:

> I have a date format of 01/01/09 12:59:59 AM that I formatted to be
> 01/01/01. When I run the query, the 01/01/01 field is put into the table as
> a text field.. this screws with my crosstab when I sort ascending...
> Thoughts?

 
Reply With Quote
 
John Spencer MVP
Guest
Posts: n/a
 
      11th Jun 2009
When you use the format function you are converting the date to a string?
Try using DateValue(SomeDateField) to return a date. IF SomeDateField Can be
null then you will need a slightly more complex statement to strip off the time.

IIF(IsDate(SomeDateField),DateValue(SomeDateField),Null)



John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

MarieG wrote:
> I have a date format of 01/01/09 12:59:59 AM that I formatted to be
> 01/01/01. When I run the query, the 01/01/01 field is put into the table as
> a text field.. this screws with my crosstab when I sort ascending...
> Thoughts?

 
Reply With Quote
 
MarieG
Guest
Posts: n/a
 
      11th Jun 2009
Here is the SQL view.. Also, when I format the date, I'm asking it to give
me the MONTH, not just the date. Thanks so much!!!

SELECT "COMPANY" AS Company, [dbo_vBilling_Visits-TMC002-OGA].DateOfService,
[dbo_PatientVisitProcsTMC002-OGA].CPTCode,
[dbo_PatientVisitProcsTMC002-OGA].RVU, Format([DATEOFSERVICE],"mm/dd/yy") AS
[DOS MONTH] INTO [CPT COUNT]
FROM [Date Range], [dbo_vBilling_Visits-TMC002-OGA] INNER JOIN
[dbo_PatientVisitProcsTMC002-OGA] ON
[dbo_vBilling_Visits-TMC002-OGA].PatientVisitID =
[dbo_PatientVisitProcsTMC002-OGA].PatientVisitId
WHERE ((([dbo_vBilling_Visits-TMC002-OGA].DateOfService) Between [FROM DATE]
And [TO DATE]));


"KARL DEWEY" wrote:

> >>I have a date format of 01/01/09 12:59:59 AM

> Where is the above data at when you format it?
>
> >>When I run the query, the 01/01/01 field is put into the table as a text field.

> What kind of query is it? What is the data type of the field in the table?
>
> Post the SQL of your query that puts it in the table. Open query in design
> view, click on VIEW - SQL View, highlight all, copy, and paste in a post.
>
> "MarieG" wrote:
>
> > I have a date format of 01/01/09 12:59:59 AM that I formatted to be
> > 01/01/01. When I run the query, the 01/01/01 field is put into the table as
> > a text field.. this screws with my crosstab when I sort ascending...
> > Thoughts?

 
Reply With Quote
 
MarieG
Guest
Posts: n/a
 
      11th Jun 2009
And this is the Crosstab Query that I'm making from the first Query. In
designt view, I have the DOS MONTH item to sort ASCENDING.. but it doesn't??

TRANSFORM Count([CPT COUNT].CPTCode) AS CountOfCPTCode
SELECT [CPT COUNT].Company
FROM [Date Range], [CPT COUNT]
GROUP BY [CPT COUNT].Company
ORDER BY [CPT COUNT].[DOS MONTH]
PIVOT [CPT COUNT].[DOS MONTH];


"MarieG" wrote:

> Here is the SQL view.. Also, when I format the date, I'm asking it to give
> me the MONTH, not just the date. Thanks so much!!!
>
> SELECT "COMPANY" AS Company, [dbo_vBilling_Visits-TMC002-OGA].DateOfService,
> [dbo_PatientVisitProcsTMC002-OGA].CPTCode,
> [dbo_PatientVisitProcsTMC002-OGA].RVU, Format([DATEOFSERVICE],"mm/dd/yy") AS
> [DOS MONTH] INTO [CPT COUNT]
> FROM [Date Range], [dbo_vBilling_Visits-TMC002-OGA] INNER JOIN
> [dbo_PatientVisitProcsTMC002-OGA] ON
> [dbo_vBilling_Visits-TMC002-OGA].PatientVisitID =
> [dbo_PatientVisitProcsTMC002-OGA].PatientVisitId
> WHERE ((([dbo_vBilling_Visits-TMC002-OGA].DateOfService) Between [FROM DATE]
> And [TO DATE]));
>
>
> "KARL DEWEY" wrote:
>
> > >>I have a date format of 01/01/09 12:59:59 AM

> > Where is the above data at when you format it?
> >
> > >>When I run the query, the 01/01/01 field is put into the table as a text field.

> > What kind of query is it? What is the data type of the field in the table?
> >
> > Post the SQL of your query that puts it in the table. Open query in design
> > view, click on VIEW - SQL View, highlight all, copy, and paste in a post.
> >
> > "MarieG" wrote:
> >
> > > I have a date format of 01/01/09 12:59:59 AM that I formatted to be
> > > 01/01/01. When I run the query, the 01/01/01 field is put into the table as
> > > a text field.. this screws with my crosstab when I sort ascending...
> > > Thoughts?

 
Reply With Quote
 
KARL DEWEY
Guest
Posts: n/a
 
      11th Jun 2009
Format your date in the crosstab query, not in the first query.

Try these changes --
[CPT COUNT] --
SELECT "COMPANY" AS Company, [dbo_vBilling_Visits-TMC002-OGA].DateOfService,
[dbo_PatientVisitProcsTMC002-OGA].CPTCode,
[dbo_PatientVisitProcsTMC002-OGA].RVU
FROM [dbo_vBilling_Visits-TMC002-OGA] INNER JOIN
[dbo_PatientVisitProcsTMC002-OGA] ON
[dbo_vBilling_Visits-TMC002-OGA].PatientVisitID =
[dbo_PatientVisitProcsTMC002-OGA].PatientVisitId
WHERE ((([dbo_vBilling_Visits-TMC002-OGA].DateOfService) Between [FROM DATE]
And [TO DATE]));

TRANSFORM Count([CPT COUNT].CPTCode) AS CountOfCPTCode
SELECT [CPT COUNT].Company
FROM [CPT COUNT]
GROUP BY [CPT COUNT].Company
PIVOT Format([DATEOFSERVICE],"yyyy mm/dd/yy")


"MarieG" wrote:

> And this is the Crosstab Query that I'm making from the first Query. In
> designt view, I have the DOS MONTH item to sort ASCENDING.. but it doesn't??
>
> TRANSFORM Count([CPT COUNT].CPTCode) AS CountOfCPTCode
> SELECT [CPT COUNT].Company
> FROM [Date Range], [CPT COUNT]
> GROUP BY [CPT COUNT].Company
> ORDER BY [CPT COUNT].[DOS MONTH]
> PIVOT [CPT COUNT].[DOS MONTH];
>
>
> "MarieG" wrote:
>
> > Here is the SQL view.. Also, when I format the date, I'm asking it to give
> > me the MONTH, not just the date. Thanks so much!!!
> >
> > SELECT "COMPANY" AS Company, [dbo_vBilling_Visits-TMC002-OGA].DateOfService,
> > [dbo_PatientVisitProcsTMC002-OGA].CPTCode,
> > [dbo_PatientVisitProcsTMC002-OGA].RVU, Format([DATEOFSERVICE],"mm/dd/yy") AS
> > [DOS MONTH] INTO [CPT COUNT]
> > FROM [Date Range], [dbo_vBilling_Visits-TMC002-OGA] INNER JOIN
> > [dbo_PatientVisitProcsTMC002-OGA] ON
> > [dbo_vBilling_Visits-TMC002-OGA].PatientVisitID =
> > [dbo_PatientVisitProcsTMC002-OGA].PatientVisitId
> > WHERE ((([dbo_vBilling_Visits-TMC002-OGA].DateOfService) Between [FROM DATE]
> > And [TO DATE]));
> >
> >
> > "KARL DEWEY" wrote:
> >
> > > >>I have a date format of 01/01/09 12:59:59 AM
> > > Where is the above data at when you format it?
> > >
> > > >>When I run the query, the 01/01/01 field is put into the table as a text field.
> > > What kind of query is it? What is the data type of the field in the table?
> > >
> > > Post the SQL of your query that puts it in the table. Open query in design
> > > view, click on VIEW - SQL View, highlight all, copy, and paste in a post.
> > >
> > > "MarieG" wrote:
> > >
> > > > I have a date format of 01/01/09 12:59:59 AM that I formatted to be
> > > > 01/01/01. When I run the query, the 01/01/01 field is put into the table as
> > > > a text field.. this screws with my crosstab when I sort ascending...
> > > > Thoughts?

 
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
change data type from text to date/time =?Utf-8?B?c2l2ZQ==?= Microsoft Access Getting Started 1 20th Mar 2007 11:33 AM
Change the Data Type from text to date/time vikash.verma Microsoft Access Form Coding 2 22nd Mar 2004 09:50 PM
Change the Data Type from text to date/time vikash.verma Microsoft Access Forms 1 22nd Mar 2004 09:50 PM
Change the Data Type from text to date/time vikash.verma Microsoft Access Reports 1 22nd Mar 2004 09:50 PM
data type problem with ado to access db... date/time field Brian Henry Microsoft ADO .NET 2 6th Oct 2003 02:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:27 PM.