+ Reply to Thread
Results 1 to 5 of 5

how to format field in access query without changing the name

  1. #1
    Forum Contributor
    Join Date
    08-18-2018
    Location
    Canada
    MS-Off Ver
    365
    Posts
    151

    how to format field in access query without changing the name

    Is there a way to format a field in access query without changing the name of the original field?

    Example: Field name is DATE, I want to format it with dd/mm/yy. My code in access would be Date: Format([Date],"dd/mm/yy") but it will not work as the NEW NAME is similar on my original name, I don't want to change my original field name which is DATE. Is there any solution to this?

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,884

    Re: how to format field in access query without changing the name

    First off, your issue may be the field name itself. DATE is a reserved Access name that should never be used as a field name. Look at information about Reserved Names.

    https://support.office.com/en-ie/art...9-f855bdd9c5a2
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    08-18-2018
    Location
    Canada
    MS-Off Ver
    365
    Posts
    151

    Re: how to format field in access query without changing the name

    Apologies, my example may be incorrect. But how about Exp1: Format([DATE1],"dd/mm/yy")? My question would be, how do I name my exp1 the same as the original field name which is DATE1?

    Btw, thanks for the reserved names, I didn't know that.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,884

    Re: how to format field in access query without changing the name

    I don't believe you can. Once you create an expression, the SQL statement from the UI creates an alias. If the expression is the same name as the field name it creates a circular error. The expression needs to have a different name, ie. "NewDate1"

  5. #5
    Forum Contributor
    Join Date
    08-18-2018
    Location
    Canada
    MS-Off Ver
    365
    Posts
    151

    Re: how to format field in access query without changing the name

    Thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Excel VBA - ADODB Query Access Database when field is equal to variable
    By ironfelix717 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-25-2018, 09:07 PM
  2. [SOLVED] access query design help - adding field while keeping all records
    By darpodo in forum Access Tables & Databases
    Replies: 9
    Last Post: 05-11-2016, 08:37 AM
  3. [SOLVED] choose access field for query in combobox
    By sebastienkanj in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 05-23-2013, 04:05 AM
  4. [SOLVED] How can Access form run a query if field is not null?
    By jgomez in forum Access Tables & Databases
    Replies: 10
    Last Post: 01-14-2013, 02:35 PM
  5. Changing access query criteria from Excel
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-26-2011, 01:40 AM
  6. Changing an Access Query in Excel
    By Osmar Mateus in forum Excel General
    Replies: 1
    Last Post: 04-12-2006, 11:21 AM
  7. [SOLVED] Excel - MS Query - changing location of Access data source
    By Thomas Becker in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-01-2005, 10:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1