Share via

Lookup Value In Expression

Anonymous
2015-08-03T09:21:08+00:00

Hi All

I hope that someone can help me. I am trying to do something that I am sure is really simple but I am new to Access and I just cant figure it out.

I want to build an email address out of 2 fields in my table but one of the fields is a lookup from another table so when I try to join the fields in either the expression builder or a macro I just get the ID value. for example ******@abc.com instead of ******@abc.com.

my table as as follows:

Users

UserID (AutoNumber) FirstName (Text) LastName (Tex) Department (Number) (Lookup) Email (Calculation)
1 Jo Bloggs Sales

Departments

DepartmentID (AutoNumber) DepartmentName
1 Sales

The expression I have been using the calculation field is [FirstName] & "." & [Department] & "@abc.com"

If anyone can point me in the right direction that would be great.

Thank you in advance.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. ScottGem 68,830 Reputation points Volunteer Moderator
    2015-08-03T14:49:53+00:00

    The same way you did in a query. Use the Same expression (only substitue Control names for field names) 

    Use an Unbound with a controlshouce set to:

    =[Firstname] & [cboDept].Column(1) & ".domain.com"

    Or whatever the email address formula.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2015-08-03T14:45:03+00:00

    Hi Scott

    Sorry but like I said I am new to access.

    I have removed the lookup from the table and have now done this in the form. so that I have a combo box on the form which lists my departments from my departments table. I have also created the query to join the DepartmentName and the users FirstName name together and from this have created a new column to create the email address. So I now have the email address as I want it in the query.

    What I now cant figure out is how to show this on the form.

    Sorry again and thank you for the help.

    Was this answer helpful?

    0 comments No comments
  3. ScottGem 68,830 Reputation points Volunteer Moderator
    2015-08-03T11:47:20+00:00

    First, Lookups should be done On the form level, not on the table level.

    You will not be able to create a calculation field for this. But its easy to do in a query. Just join the employee table to the Department table and then enter your expression.

    Was this answer helpful?

    0 comments No comments