Results 1 to 14 of 14
  1. #1
    Thomasso is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Czech Republic
    Posts
    277

    Question Query displays something different than form

    Hi,

    I'm dealing with this weird issue in my Access database.

    Basically I have a form with potential customers. I want to assign a sales representative who is responsible for this potential customer (his abbreviation).

    For example:
    Company 1 | assign Ja
    Company 2 | assign Jo
    Company 3 | assign Jo
    etc.

    My architecture is as follows:
    tblEmployees: ID, Name, Abbreviation (for example Jack Miller | Ja)
    tblPotentialCustomers: ID, Company, Employee Assigner (Ja, Jo...)



    Then I have a Data Entry form for the Potential Customers... I have a combo box in there and I want to feed it employees from tblEmployees. This works fine by doing this:
    SELECT tblEmployees.ID, tblEmployees.Abbreviation FROM tblEmployees;
    This combo box has number if columns 2 and the bound column is 1.
    I correctly see the abbreviations in the combo and it's correctly bound to respective employees.

    When I select an employee for a particular customer, the value is correctly saved to tblPotentialCustomers.

    Everything then goes through qryPotentialCustomers which also displays the abbreviation correctly.

    Finally, this query then feeds the form where potential customers are displayed.


    There is a text box to display the abbreviation for each potential customer, which is fed by the query value. But for some reason, this text box displayed the employee ID, not the abbreviation! (the bound value from the combo box above).
    It displays its source as Employee from the query, where abbreviation is displayed.

    I am totally confused here and would like your advice how to display the abbreviation.

    Thank you :-)

    Tomas

  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,610
    Try:
    = [NameOfCombo].Column(1)
    As the Control Source property of the text box
    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
    Thomasso is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Czech Republic
    Posts
    277
    Thanks, that returned the #NAME error though. The combo box is in a different form than the textbox.

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Add the "Abbreviation" field to the forms query so it can be used as the Record Source property of the textbox
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    Thomasso is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Czech Republic
    Posts
    277
    That's exactly what I did. The abbreviation is displayed in the query and it's set as a record source for the text box. But the text box displays the ID.

  6. #6
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    What is shown in the abbreviation field if you open 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

  7. #7
    Thomasso is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Czech Republic
    Posts
    277
    The thing I want - the abbreviation :-D

  8. #8
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Quote Originally Posted by Thomasso View Post
    The thing I want - the abbreviation :-D
    Then I would urge you to check carefully that the text box does have "abbreviation" as its Record Source and that you're not perhaps mistakenly looking at the name of the control. We've all done it

    Alternatively, you could post a copy of the db for us to investigate.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  9. #9
    Thomasso is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Czech Republic
    Posts
    277
    Everything really seems to be in place correctly. I'm sending some screenshots. Unfortunately the DB isn't in English.





    I could send you the database if you think you could have a look?

  10. #10
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Quote Originally Posted by Thomasso View Post
    Everything really seems to be in place correctly. I'm sending some screenshots. Unfortunately the DB isn't in English.

    I could send you the database if you think you could have a look?
    Make a copy.
    Do a "Compact and Repair".
    Zip the file.
    Attach the zipped file to your post with some instruction on which form is not working as required.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  11. #11
    Thomasso is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Czech Republic
    Posts
    277
    db_help.zip

    Ok I'm attaching the file. I deleted most of the tables and forms because of data sensitivity. I populated the important fields with dummy data.

    We're looking at frmObchodniTrychryr

    As you can see, it displays a figure "4" whereas the query field is "JD".

  12. #12
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Unfortunately I don't know a single word of Russian. However, take a look at the attached db which I believe now works as required.

    The problem here that you had used a lookup field in the table "tblProspects" which I have now changed. You may need to make changes elsewhere in the db. I have also added the table "tblZamestnanci" to the query so that the field called "Zkratka" could be added to the query. This is now used as the Control Source for the errant text box. I have not checked for the use of any other lookup fields in your tables. I'll leave that to you. Do NOT use lookup fields in tables. see: http://access.mvps.org/access/tencommandments.htm

    Post back if you have any questions
    Attached Files Attached Files
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  13. #13
    Thomasso is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Czech Republic
    Posts
    277
    Thanks! That did it.

    BTW - it's not Russian, lol. It's Czech and we don't like Russians

  14. #14
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Quote Originally Posted by Thomasso View Post
    Thanks! That did it.

    BTW - it's not Russian, lol. It's Czech and we don't like Russians
    My sincere apologies.
    I stuck a couple of words into google translate and it identified the language as Russian.
    Clearly I don't know Czechoslovakian any better than I do Russian .
    However, having posted a working solution for you I trust that we will avoid any animosity
    Good luck with your project.

    PS
    Thanks for your acknowledgement using the reputation star.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. Replies: 1
    Last Post: 06-22-2020, 09:19 AM
  2. Replies: 4
    Last Post: 12-25-2018, 05:32 PM
  3. Replies: 5
    Last Post: 08-28-2018, 03:56 AM
  4. Replies: 5
    Last Post: 10-04-2017, 01:03 PM
  5. Query that displays previous row as well
    By mccarthy in forum Queries
    Replies: 5
    Last Post: 02-20-2011, 05:31 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