Thanks, your explanation shows the problem.
First, the Bound Column should be the column that contains the unique field
from the lookup table (ProjectTeam). I would assume this to be your ID
field. Therefore the Bound Column should be 2 (yes, the Column property as
used in the textbox is zero based, but the bound Column property is 1
based). The Control Source for the combo box should be the field that the
bound column should be stored in, in this case UserID. The first visible
column, in this case PTName/TaksAssignedTo would be what shows in the combo
box after you make your selection.
You don't need to store both values in the destination table (Tasks), the
combo box will show the correct text value when it sees the corresponding ID
field in its Control Source. When ever you need to show the name at a later
time, such as in a report, you would include both tables in the query and
link them on the ID field then use the PTName field from ProjectTeam. The
link will make sure that the correct text field lines up with the ID stored
in Tasks.
The textbox isn't storing the value because it's not bound to a field in the
table, instead it has an equation as a Control Source.
--
Wayne Morgan
MS Access MVP
Mary said:
I made the following revisions and the UserID field is still not retained
in
the Tasks table.
Here's the SQL:
SELECT Tasks.[TaskNumber], Tasks.[TaskName], Tasks.[TaskDescription],
Tasks.[TaskType], Tasks.[TaskActivity], Tasks.UserID,
Tasks.[TaskAssignedTo],
Tasks.[TaskSponsor], Tasks.[TaskCreationDate], Tasks.[TaskDueDate],
Tasks.[TaskCompleteDate], Tasks.[TaskNotes], Tasks.[TaskEstimatedHours],
Tasks.[TaskSize], Tasks.Priority, Tasks.CurrentUserID, Tasks.EntryTime
FROM Tasks
WITH OWNERACCESS OPTION;
Combo Box (to autofill TaskAssignedTo field in Tasks Table)
Name: cboTaskAssignedTo
Control Source: Task Assigned To
Row Source: SELECT ProjectTeam.[PTName] AS [TaskAssignedTo],
ProjectTeam.[PTUserID] AS UserID FROM ProjectTeam;
Column Count: 2
Bound Column 1
Text Box (to autofill UserID field in Tasks Table)
Name: txtUserID
Control Source: =[cboTaskAssignedTo].[Column](1)
(Access added the brackets when I tabbed off the field)
The Tasks table is still only retaining the Name and not the ID.