Email - Using Exchange address based on form input

V

vavroom

I hope you'll be able to assist me with this. I've searched around
and can't seem to find the right answer for my problem.

I'm building a form with three linked lists. In the first list, the
user can select a location. When a location has been selected, items
related to that location appear in the second list. When the user
selects an item in the second list, the name of a person associated
with the item in question appears in the third list. So far so good.

I need to have my users able to click on a button, which would build an
email. This process, I've got mostly done, and it's like I can
smell "home" but am just not hitting it. I hope you can help me
with it. I fear it might be something small I'm not 'seeing'.

The list (List4) which provides the person's name is a multi column
list, bound on the first column (fldPeopleID), which is the unique key
for tblPeople.

I then have two textboxes with Dlookup, one calling fldFName, the other
one calling fldLName from tblPeople, based on the bound column in List4
(I probably could get something done in a simpler way, but bear with me
at this point). The textboxes are respectively named txtFName and
txtLName.

I linked the global address book from our Exchange server in the Access
db. I then created another textbox looking up the alias field in that
table, based on the combination of txtLName and txtFName. This is
where my problem is. I can't seem to get that Dlookup going
properly.

This is what I currently have:
Code:
=DLookUp("[alias]","Global Address List"," (([Global Address
List].Last)=Forms!frmInfo!txtLName) AND (( [Global Address
List].First)=Forms!frmInfo!txtFName)")

The logic seems ok, because if I try it using an actual name, it brings
up the right alias, i.e., the following works:
Code:
=DLookUp("[alias]","Global Address List"," (([Global Address
List].Last)='Steenhout') AND (( [Global Address
List].First)='Nic')")

What I currently have returns nothing at all, no #error or #name.

Any help on this would be greatly appreciated.

As a side issue, still with dlookup, I'd rather put the dlookup in
the source code in an AfterUpdate event. But for some reason, my
dlookups don't work at all when I do that. I suspect my syntax is
wrong here, but I'm not sure how to modify it to make it work. Any
thoughts on this?

Code:
Private Sub List4_AfterUpdate()
Me.txtLName.ControlSource = DLookup("[fldLName]", "tblPeople",
"[fldPeopleID]= " & Forms!frmInfo.List4)
End Sub

Thanks a lot in advance for any info you might be able to provide.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top