DLookup dilemma

  • Thread starter Thread starter JohnE
  • Start date Start date
J

JohnE

Greetings. I have a dilemma plaging me on a Sunday
night. I have a form (usrfrmPRAProjectTeamMembers) that
is a continuous style form. The form field
(ProjectTeamMember) is a drop list of names. What I am
trying to do is to reduce the time for a person when
selecting the team member by having the remainder of the
fields pre-fill with the team members info. Here is a
sample line. But, no matter what name is selected in the
ProjectTeamMember drop list, the lookups are showing the
first person listed on the table. Whjat am I missing
here? Thanks to anyone that responds.
*****************
Me.ProjectTeamMemberEmail = DLookup
("[ProjectTeamMemberEmail]", "tblProjectTeamMembers",
[Forms]![usrfrmPRAProjectTeamMembers]![ProjectTeamMember])
*****************
....John
 
JohnE said:
Greetings. I have a dilemma plaging me on a Sunday
night. I have a form (usrfrmPRAProjectTeamMembers) that
is a continuous style form. The form field
(ProjectTeamMember) is a drop list of names. What I am
trying to do is to reduce the time for a person when
selecting the team member by having the remainder of the
fields pre-fill with the team members info. Here is a
sample line. But, no matter what name is selected in the
ProjectTeamMember drop list, the lookups are showing the
first person listed on the table. Whjat am I missing
here? Thanks to anyone that responds.
*****************
Me.ProjectTeamMemberEmail = DLookup
("[ProjectTeamMemberEmail]", "tblProjectTeamMembers",
[Forms]![usrfrmPRAProjectTeamMembers]![ProjectTeamMember])
*****************

You criteria has no comparison. *What* is equal to
[Forms]![usrfrmPRAProjectTeamMembers]![ProjectTeamMember]? A human reading this
can assume it's the field [ProjectTeamMemberEmail], but the expression doesn't
indicate that to the program.

Me.ProjectTeamMemberEmail = DLookup ("[ProjectTeamMemberEmail]",
"tblProjectTeamMembers",
[ProjectTeamMemberEmail]=[Forms]![usrfrmPRAProjectTeamMembers]![ProjectTeamMembe
r])
 
I added the extra to the criteria. The email field now
goes blank.
Any further thoughts?
*** John

-----Original Message-----
JohnE said:
Greetings. I have a dilemma plaging me on a Sunday
night. I have a form (usrfrmPRAProjectTeamMembers) that
is a continuous style form. The form field
(ProjectTeamMember) is a drop list of names. What I am
trying to do is to reduce the time for a person when
selecting the team member by having the remainder of the
fields pre-fill with the team members info. Here is a
sample line. But, no matter what name is selected in the
ProjectTeamMember drop list, the lookups are showing the
first person listed on the table. Whjat am I missing
here? Thanks to anyone that responds.
*****************
Me.ProjectTeamMemberEmail = DLookup
("[ProjectTeamMemberEmail]", "tblProjectTeamMembers",
[Forms]![usrfrmPRAProjectTeamMembers]! [ProjectTeamMember])
*****************

You criteria has no comparison. *What* is equal to
[Forms]![usrfrmPRAProjectTeamMembers]!
[ProjectTeamMember]? A human reading this
can assume it's the field [ProjectTeamMemberEmail], but the expression doesn't
indicate that to the program.

Me.ProjectTeamMemberEmail = DLookup ("[ProjectTeamMemberEmail]",
"tblProjectTeamMembers",
[ProjectTeamMemberEmail]=[Forms]!
[usrfrmPRAProjectTeamMembers]![ProjectTeamMembe
r])


.
 
JohnE said:
I added the extra to the criteria. The email field now
goes blank.
Any further thoughts?
*** John

Are you sure the ComboBox...

[Forms]![usrfrmPRAProjectTeamMembers]![ProjectTeamMember]

....has the value you want? If it has multiple columns, its value might not be what
you see, but rather a key field value. Try your DLookup in the Immediate window with
a hard-coded literal instead of a form reference and see if you get the correct
return value.
 
Back
Top