Results 1 to 4 of 4
  1. #1
    Perimeter is offline Novice
    Windows 10 Office 365
    Join Date
    Feb 2023
    Posts
    11

    Building a calculated field in a query


    Table1 has fields "Part" and "TotalMade"
    Table2 has fields "Part" and "NumSubAssy"
    Each field is has Data Type set to Number.

    I'm building a query with a calculated field that simply multiplies TotalMade and NumSubAssy.

    In the Query design I have both tables joined via "Part"
    In Query Design, in the Field section of a blank field I have entered: TotalAssy:[TotalMade]*[NumSubAssy]
    I keep getting a "Type mismatch in expression" when I run the query.

    What am I doing wrong?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Then the fields must not both be number type.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Can you post a copy of the db. Just the two tables with a couple of fictitious records in each table to illustrate the problem.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    I think you might be using a lookup table in on of the tables for the Part (so it shows the part name but actually stores the PartID) so when you join them you have a number (PartID) joined to short text (Part).
    http://access.mvps.org/access/lookupfields.htm

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Replies: 1
    Last Post: 02-03-2016, 06:54 PM
  2. Replies: 2
    Last Post: 12-30-2014, 01:32 PM
  3. Replies: 1
    Last Post: 08-25-2014, 01:23 PM
  4. Replies: 7
    Last Post: 08-30-2013, 03:43 PM
  5. Replies: 3
    Last Post: 02-13-2013, 10:15 AM

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