Results 1 to 13 of 13
  1. #1
    raychow22 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    145

    Expression Builder to Display Specify Column Field

    Hi Guys,



    Is it possible to use expression builder to display a specify column field.

    Right now I want a field to display the QEIinitials of the [Inspector Names] rather than it's [ID] which is displayed.

    Click image for larger version. 

Name:	1.png 
Views:	9 
Size:	30.1 KB 
ID:	29324Click image for larger version. 

Name:	2.png 
Views:	9 
Size:	9.7 KB 
ID:	29325Click image for larger version. 

Name:	3.png 
Views:	10 
Size:	17.9 KB 
ID:	29326


    Thanks!

  2. #2
    raychow22 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    145
    The expression builder is the "File Name" field column

  3. #3
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Join the table holding those values to the Query (joining then), and return the QEInitials field.

  4. #4
    raychow22 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    145
    Quote Originally Posted by JoeM View Post
    Join the table holding those values to the Query (joining then), and return the QEInitials field.
    Sorry! I don't exactly know how to set that up.. can you explain it more?

  5. #5
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Where are you entering this expression?
    Is it in a query?
    What is the name of your table with the QE details?

  6. #6
    raychow22 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    145
    tblQEINames and tblInspectionReports are the two tables from the picture. I want the File Name to display 201767-RC instead of 201767-1. "1" comes from the name ID frm tblQEInames.

  7. #7
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    But are you doing this in a query?

    If so, add both of those tables to the query and join them.
    Then, for the last piece of your expression, select the QEInitials field from the tblQEINames table.

  8. #8
    raychow22 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    145
    I believe I am limited on fields in my tblInspectionReports. Is there a way to add queries into the expression builder?

  9. #9
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I am still trying to find out where exactly you are trying to do this.
    In Access, there are various objects - Tables, Queries, Forms, Reports, Macros, and Modules.
    Which one of these are you trying to build this expression in?

  10. #10
    raychow22 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    145
    JoeM,

    I found the solution. I was trying to build the expression in Tables. Solution was to get rid of the "ID name" in the query row source in both my "Forms" and "Table". It worked out perfectly.

  11. #11
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I highly recommend NOT doing that. Even though the new version of Access allow you to do expressions (calculated fields) right in the table level, it is generally recommended that you don't do that.
    No other database programs allow for that. So if you ever needed to convert to SQL or something like that down the road, it wouldn't work.
    Usually, the best place for calculations are queries. Then you can use queries as the Control Source of your Forms, Reports, Exports, etc.

  12. #12
    raychow22 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    145
    Quote Originally Posted by JoeM View Post
    I highly recommend NOT doing that. Even though the new version of Access allow you to do expressions (calculated fields) right in the table level, it is generally recommended that you don't do that.
    No other database programs allow for that. So if you ever needed to convert to SQL or something like that down the road, it wouldn't work.
    Usually, the best place for calculations are queries. Then you can use queries as the Control Source of your Forms, Reports, Exports, etc.
    Thanks JoeM for the insight.

    I wouldn't really know how to do that... so what I'm basically trying to accomplish here is to make a Unique ID for each record (From Form to Table) that my daily inspector's report. So it would be the Date() & the Initials() of the inspector. Do you think writing a code in my "Form" would be better vs. having a calculated field?

  13. #13
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    what I'm basically trying to accomplish here is to make a Unique ID for each record
    Your Unique ID should not be an Expression, as if the fields used in the Expression change, so will this field, and that could cause real problems. It should be a hard-coded value. It can be calculated (usually via VBA, but it should not be formula (Expression).

    I wouldn't really know how to do that...
    Are you saying that you don't know how to create a query in Access? I am not trying to be mean or anything, but that is one of the most basic things you can do in Access, and one of the first things to learn (it is one of the main reasons for using Access). You definitely will want to how to join Tables in a Query, and the different types of Joins and what they do. See here for some reading:
    https://support.office.com/en-us/art...3-b39572400c19
    You may also want to pick up a good introductory book on Access, as so much builds on the basic stuff, and without a good foundation, you are going to be in for a lot of frustration.

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

Similar Threads

  1. Expression Builder?
    By ddeaton66 in forum Queries
    Replies: 1
    Last Post: 09-16-2016, 08:37 AM
  2. Replies: 4
    Last Post: 05-03-2016, 01:51 PM
  3. Replies: 1
    Last Post: 05-09-2013, 07:54 PM
  4. Replies: 2
    Last Post: 11-20-2012, 03:21 AM
  5. expression builder
    By tonyl in forum Access
    Replies: 3
    Last Post: 11-26-2011, 12:00 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