Results 1 to 6 of 6
  1. #1
    jaryszek is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    568

    Calculated field with where clause within Query

    Hi,



    i want to add where clause to multiply 2 fields based on table:

    Size 1 , Label GiB
    Size 1, Label TiB

    And now i want to get some field from query, for example [Field1]*[Size] Where Label = 'GiB'

    How can i do it using builder in Access query?

    Best,
    Jacek

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,991
    GIB:Field1*Size
    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

  3. #3
    jaryszek is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    568
    Hi ridders52,

    this is not working. I am getting computed 2 computed values: GiB and TiB and i want to get only these one for GiB.

    You simply multiplied Field1*Size by each Label. I want to multiply only by specific label,

    Best,
    Jacek

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,991
    Sorry - misread your post.
    Is this what you want?

    Code:
    SELECT Table1.Field1, Table1.Size, Table1.Label, [Field1]*[Size] AS Expr1 FROM Table1
    WHERE (((Table1.Label)='GIB'));
    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
    jaryszek is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    568
    Hmm not exactly.

    My query looks like:

    Click image for larger version. 

Name:	Screenshot_1.png 
Views:	8 
Size:	187.4 KB 
ID:	33290

    It is not possible to do something within column GiB: MemorySizeGib * Size?

    Best,
    Jacek

  6. #6
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,991
    Why have you got ten tables in your query including a Cartesian join?
    Is it read only?

    Assuming your memorysizegib is what you called field, what you have is what I wrote in my first reply when I thought gib was a derived field name.
    In my second reply I thought it was a record value in a field called 'label'.

    I've now got no idea what you mean so little point guessing.
    Suggest you post some sample records so I can see what you want. Hide any irrelevant fields
    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

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: 4
    Last Post: 03-20-2014, 03:52 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