Results 1 to 6 of 6
  1. #1
    crobaseball is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    128

    create a calculated field in a query but not have it shown? i.e.-create a variable?

    Hi, I've got a query I'm creating that uses several different calculated fields. It would be very helpful for anyone who follows me to have several variables created. basically, rather than have

    Code:
    List: Int(100*([Lines.Price]+[Lines.Freight])*[Lines.DealerAMultiplier]+0.5)/50
    I would like to have

    Code:
    List: Int(100*[DLRA]+0.5)/50
    where DLRA = [Lines.Price]+[Lines.Freight])*[Lines.DealerAMultiplier]

    Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Not something I ever thought about. Why don't you test it and find out?
    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
    crobaseball is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    128
    I have been. When I try to create DLRA in a field, it disappears when I uncheck the "Shown" box. Can I somehow get to the VBA in a query to create the variable there?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Nice to know you attempted and the results.

    I just tested and confirmed your results. The field is dropped when query is saved. What is wrong with showing field in query? Just don't show it on form or report.

    I do not think VBA will be helpful. Referencing a VBA function in query is still a calculated field.
    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.

  5. #5
    crobaseball is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    128
    Because I'm importing the data into Excel. And hiding it after pulling it in is a pain in the @$$.

    I'm pretty sure this just can't be done. Ah well.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    You are using the export wizard?

    Build query to do the calcs. Use that query as source for another query for the fields to export to Excel.
    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.

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

Similar Threads

  1. Replies: 7
    Last Post: 01-16-2014, 09:17 AM
  2. Replies: 4
    Last Post: 08-05-2013, 05:30 PM
  3. Replies: 1
    Last Post: 05-09-2013, 07:54 PM
  4. Create a query With a Calculated Field
    By Content1 in forum Queries
    Replies: 2
    Last Post: 01-05-2013, 12:46 PM
  5. Create a variable from a query created in VBA
    By kaelcarp in forum Programming
    Replies: 4
    Last Post: 06-11-2010, 09:13 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