Results 1 to 9 of 9
  1. #1
    Perfac's Avatar
    Perfac is offline Expert
    Windows 7 64bit Access 2016
    Join Date
    May 2016
    Location
    Centurion Pretoria
    Posts
    618

    Field Type


    We create many calculated fields in queries like everybody. I wondered why, when these calculated fields then return a type "Short Text" I don't understand why. The fields they derive their numbers from, is number fields from a table, why does Database Documenter then say Short Text. We pick up issues then in Union Queries "Data Type mismatch in criteria expression".

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    In query design, bring the field down,
    select the field column,properties,
    set format.
    or
    use a conversion function:
    CDbl(field)
    cLng(field)

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,975
    The output datatype will depend on the calculation.
    If for example you add two numbers, the output is a number
    However if for example you apply some types of formatting, you could end up with a string.
    This can be easily shown with date fields. If you format as e.g mm/dd/yyyy you are creating a text string.

    As already stated, if necessary you can use conversion functions CInt, CLng, CDbl etc to ensure the calculated value has the required format
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    Perfac's Avatar
    Perfac is offline Expert
    Windows 7 64bit Access 2016
    Join Date
    May 2016
    Location
    Centurion Pretoria
    Posts
    618
    I selected the properties, many times it does not put available any selection. You may see that I typed in "Currency". Still Database documenter returns "Short Text". Ranman, sorry for not getting it fast. What do you mean "Use a conversion function"? CDbl........
    Click image for larger version. 

Name:	f2.png 
Views:	15 
Size:	65.5 KB 
ID:	34641Click image for larger version. 

Name:	f3.png 
Views:	15 
Size:	88.6 KB 
ID:	34642Click image for larger version. 

Name:	f1.png 
Views:	15 
Size:	130.3 KB 
ID:	34640

  6. #6
    Perfac's Avatar
    Perfac is offline Expert
    Windows 7 64bit Access 2016
    Join Date
    May 2016
    Location
    Centurion Pretoria
    Posts
    618
    Ridders. How do I use functions CInt, Clng, Cdbi. I will search for a tutorial. Thanks.

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    Perfac,

    Don't overlook the use of Google or Bing to find info/articles on Access functions etc.

    See this link for Access functions and sample of their usage.
    Also, what is the purpose of numeric suffixes on most of your fields?

  8. #8
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,975
    Just wrap your expression with the conversion function
    e.g. CLng(expression), CInt(3.25),
    for currency, use CCur
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  9. #9
    Perfac's Avatar
    Perfac is offline Expert
    Windows 7 64bit Access 2016
    Join Date
    May 2016
    Location
    Centurion Pretoria
    Posts
    618
    Thanks. Just overworked and brain dead today.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 01-13-2017, 08:54 AM
  2. UPC codes: what field type do ppl use?
    By crobaseball in forum Access
    Replies: 1
    Last Post: 07-23-2015, 03:13 PM
  3. Field Type of type-Double/Float
    By McArthurGDM in forum Access
    Replies: 3
    Last Post: 12-10-2014, 01:54 PM
  4. Replies: 4
    Last Post: 12-01-2010, 01:12 PM
  5. Replies: 0
    Last Post: 02-27-2009, 01:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums