Changing a text field in a report to a Date/Time format

  • Thread starter Thread starter Del
  • Start date Start date
D

Del

I have a query driven report the has a field called "ClockDate" and a
field called "UserID", I want to attach a Sub-Report which has a field
called "date" and a field called "UserID". I want to link the Subform
records to the main form by "UserID" to "UserID" and "ClockDate" to
"date".

The problem is the "ClockDate" field in the report is a Text field and
the "date" field in the Sub-Report is a Date/Time field.

If I open the properties of the "ClockDate" field and select format it
is blank.

Is there a way to change the format of the "ClockDate" field on the
form?

I don't want to change any format settings on the table as it may
cause other issues with links to other tables, queries etc.

Thank you!
 
Del said:
I have a query driven report the has a field called "ClockDate" and a
field called "UserID", I want to attach a Sub-Report which has a field
called "date" and a field called "UserID". I want to link the Subform
records to the main form by "UserID" to "UserID" and "ClockDate" to
"date".
The problem is the "ClockDate" field in the report is a Text field and
the "date" field in the Sub-Report is a Date/Time field.
If I open the properties of the "ClockDate" field and select format it
is blank.
Is there a way to change the format of the "ClockDate" field on the
form?
I don't want to change any format settings on the table as it may
cause other issues with links to other tables, queries etc.

A format only specifies how a value is displayed.  It has
very little to do with the actual value.  The important
property (and the one you are concerned with here) is the
Type property.

Depending on the details of your two fields, you can convert
the type of a value on the fly by using various functions.
In this case the CDate function will convert a text string
that is a valid date to a Date/Time value.  If you rename
the main report's ClockDate text box to txtClockDate and set
its control source expression to =CDate(ClockDate) then you
can set the subreport control's LinkMasterFields property
to:
        txtClockDate;UserID

--
Marsh
MVP [MS Access]- Hide quoted text -

- Show quoted text -

Thank you,
I'll give it a try...
 
Back
Top