Avatar of kenabbott
kenabbott
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Ms Access forcing field data types in Mkae Table query

Hi

When running a saved Make Table query if I want to create a field not linked to any data I can use NewField:"" to create a text field or NewField:0 to create a number field.  However is there any way of doing the same to create Date or Currency fields and can you define the type of number field

Many thanks

Ken
Microsoft Access

Avatar of undefined
Last Comment
Rey Obrero (Capricorn1)

8/22/2022 - Mon
Jeffrey Coachman

Whats the need for this?, in case there is an alternate approach.

As you stated, you can create a new filed in the query, but the datatype is not really etched in stone.

Just doing this: NewField:0
Wont necessarily stop a text value form being used

So my guess is that you can do something like this to create a date field:
NewDate: cdate(SomeValue)

Or if you want it too just "look" like a date:
NewDate: format(SomeValue,"mm/dd/yyyy")

Perhaps I am not understanding something, because a calculated field in a query typically calculates from existing fields.

You cannot really create a "New" field in a query.

(though you can create a query that creates a new field in the table)

JeffCoachman
ASKER CERTIFIED SOLUTION
peter57r

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
kenabbott

ASKER
Many thanks - Newdate:#2099/01/01# works a treat.  Any idea how you would do this with currency?
Rey Obrero (Capricorn1)

use this for the currency format of Amount field

Amount:ccur(0)
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
peter57r

the same principle...

newcur:ccur(0)
Using this technique, there isn't any way to set decimal places or currency symbol (AFAIK)
kenabbott

ASKER
Many thanks - just what I was looking for
Rey Obrero (Capricorn1)

<Using this technique, there isn't any way to set decimal places or currency symbol (AFAIK) >

it will follow your regional setting for decimal and currency symbol
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.