Results 1 to 8 of 8
  1. #1
    Khalil Handal is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Jun 2016
    Posts
    243

    Replace value of a foreign key on a report with corresponding value

    Hi,


    A query has two tables: table1 , table2
    Table2 has a field fkYears (foreign key). A report is based on this query and the report shows the fkYears (a number is shown at the report).
    The fkYears is primary key in Table3. Table3 has two fields: pkYears and ScYear.
    How can I show the ScYear value on the report instead of the fkYears?

    I know I can do this by adding Table3 to the query. Is there a way doing it without adding Table3 to the query?

    Khalil

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Is there a way doing it without adding Table3 to the query?
    What is your objection to using the query?
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Khalil Handal is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Jun 2016
    Posts
    243
    Hi,
    I thinks less tables in the query is better performance. Am I wrong ?

  4. #4
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    It is the only way you get the required value by adding the additional table.

    The query allows you to limit the number of fields produced.
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  5. #5
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Quote Originally Posted by Khalil Handal View Post
    Hi,
    I thinks less tables in the query is better performance. Am I wrong ?
    To be perfectly honest I don't actually know, but I believe that two properly indexed tables in a query would be much faster than using a single table and something like DLookup().

    Have you noticed a discernible drop in performance with two tables in the query?
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  6. #6
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    You don't need a query; open the report in design view, right click on the textbox bound to fkYears and select Changet To and select combo box. Now click the Data tab on the Properties window and click on the builder (...) on the right of the Row Source property. Add your Table 3 in there and set any desired sorting. Finally back in the Properties window set the Columns number to 2, Column Width to 0";2" and you should be done.

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

  7. #7
    Khalil Handal is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Jun 2016
    Posts
    243
    Hi,
    Thank you all for sharing your solutions.
    So, It is by adding the third table to the query or using a combo box on the report.
    Khalil

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Either way, the table included in report design. Does one perform better? I don't know - you can test it.
    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: 13
    Last Post: 03-22-2019, 04:09 PM
  2. Replies: 9
    Last Post: 02-22-2018, 08:11 AM
  3. Replace data when running report
    By Ekhart in forum Reports
    Replies: 1
    Last Post: 06-25-2016, 03:35 AM
  4. Replies: 3
    Last Post: 06-07-2012, 07:05 AM
  5. Replies: 2
    Last Post: 04-19-2012, 11:29 AM

Tags for this Thread

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