How to specify the field type for a calculated field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to force a calculated field to a particular field type. For example say I have a make-table query that includes the following calcuated field

MyNum:

The resulting table will have a field name MyNum with a field type Double (or whatever you specified in Tools | Options for default number type). But I want the field to be a Long Integer

Any help would be greatly appreciated
 
To force the data type of a calculated field, use the type conversion
functions: CLng(), CDbl(), CCur(), CDate(), etc.

Note that these functions cannot handle Nulls values, so that is not always
workable. You can work around this issue with the Date field by using
CVDate().

The better solution is to create the table ahead of time, and use an Append
query instead of a MakeTable. This way there is no question about the field
types.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Rob LMS said:
Is there a way to force a calculated field to a particular field type.
For example say I have a make-table query that includes the following
calcuated field:
MyNum: 1

The resulting table will have a field name MyNum with a field type Double
(or whatever you specified in Tools | Options for default number type). But
I want the field to be a Long Integer.
 
Back
Top