none
UserDisplayName() in a Lookup field RRS feed

  • Question

  • Hi

    I have build an Access Web App in which each user had to search for his name in the ComboBox.

    Because everyone has to use their login and password I started looking if their profile data can be used.
    I have found that UserDisplayName() will return the required value but when I use it it returns <Invalid Value>

    How can I make it work?

    Friday, September 4, 2015 4:55 PM

Answers

  • Hi MichalLip,

    >> I am only able to create a lookup which is bound by ID and I am not able to change it.

    I test under a common field instead of a lookup filed. You bind a lookup field to a combobox, and you want the combobox to show up the default value with UserDisplayName(), am I right? As my test, I am afraid that you could not achieve your requirement with this way. Just as my above reply, your Bound Field is ID instead of UserName, and your default Value is UserName, so it will not show up the correct value.

    For a workaround, we need to find the correspond id according the UserName. I suggest you do as below:
    1. Create a macro to query the ID with the parameter name

    2. Create a new button to create new record instead of using default Create record button (we could not custom the event on the default Create new record button).

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, September 9, 2015 9:14 AM

All replies

  • Hi MichalLip,

    >> I have found that UserDisplayName() will return the required value but when I use it it returns <Invalid Value>
    I made a test with your description, I assume that value of control source did not exist in your row source. I suggest you check whether all of your User Name exist in the Row Source. Here is a worked demo:

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, September 7, 2015 7:16 AM
  • Thank you very much Edward

    User Name exists in my Row Source but I found that Bound Field is ID instead of UserName. Could this be an issue?

    Best Regards,

    Michal

    Monday, September 7, 2015 9:24 AM
  • Is there a way to change this Bound Field?

    Best Regards

    Michal

    Monday, September 7, 2015 10:01 AM
  • Hi MichalLip,

    >>User Name exists in my Row Source but I found that Bound Field is ID instead of UserName. Could this be an issue?

    As my test, I think it is if you just change the Bound Field.

    >>Is there a way to change this Bound Field?

    Yes, you could change the Bound Field, but keep in mind, you need to keep the value of Control Source field in the value of Bound Field. But in this way, there is a little problem. When you add a new record, the value of combox might be Invalid Value. It is caused by setting Default Value with "UserDisplayName() ", with the default value, you need to find the correspond value in Control Source.

    In my option, I suggest you keep the Control Source, Bound Filed and Display Field the same.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    Tuesday, September 8, 2015 3:35 AM
  • Hi Edward
    Thank you for your reply.

    I am only able to create a lookup which is bound by ID and I am not able to change it.

    I have some screenshots but my account is not veryfied.

    Could you please provide me step by step guide how to do this? Could it be change after creating the lookup?

    Best Regards

    ML

    Tuesday, September 8, 2015 9:52 AM
  • Hi MichalLip,

    >> I am only able to create a lookup which is bound by ID and I am not able to change it.

    I test under a common field instead of a lookup filed. You bind a lookup field to a combobox, and you want the combobox to show up the default value with UserDisplayName(), am I right? As my test, I am afraid that you could not achieve your requirement with this way. Just as my above reply, your Bound Field is ID instead of UserName, and your default Value is UserName, so it will not show up the correct value.

    For a workaround, we need to find the correspond id according the UserName. I suggest you do as below:
    1. Create a macro to query the ID with the parameter name

    2. Create a new button to create new record instead of using default Create record button (we could not custom the event on the default Create new record button).

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, September 9, 2015 9:14 AM
  • Hi Edward.

    It works!

    Thank you again!

    Best Regards
    Very greatful

    Michal

    Wednesday, September 9, 2015 11:02 AM