Full Version: Updating data on subform
UtterAccess Forums > Microsoft® Access > Access Forms
scottdan25
I have created a subform which is opened by clicking a box on the main form, it is filtered by ActionID which is common to both the form and subform
.
The subform relates to a table that only has three fields, they are:
tblActionEmpID (primary key)
ActionID
EmployeeID
mployeeID is a combo box that the user can select multiple employees, the problem is that the ActionID does not update itself in this table, it keeps defaulting to 0 even though I have come from the main form which the record could be 7 for example.
I have tried requery and refresh but I don't think that is my issue. I cannot enforce referential integretity between these two ActionID's as it is possible that one will be blank. Any help would be greatly appreciated.
Jack Cowley
We need more information. What is the structure of the table the main form is based on? Is the ActionID the PK of the main forms Record Source? Why do you need to click '..a box on the main form...' to open/filter the subform? Also, a combo box does not allow multiple selections, but maybe you mean they can select another Employee in the next record in the subform....
If ActionID is the PK of the table the main form is based on then the subform should work... If the FK in the subform is not updating then check your Master/Child links. The FK in the subform must be the PK in your main form...
I hope this helps as I am about to leave the UA building for the day....
Jack
scottdan25
Main table (tblActions) structure is:
ActionID (Primary Key)
RiskRegisterID
DateAdded
Task
TargetDate
Status
Discussion
ctionID is the primary key and it is linked in the relationships table to the tblActionEmpID outlined above by the ActionID field (cannot force referential integretity though).
The click box is designed so the user clicks on it, this opens my subform as the user can select multiple EmployeeID, after they have done this and closed then the box they initially clicked on displays concatenated initials of the people selected. eg. SD, KM, TY all in one cell. I suppose then my subform is actually a form, there is no Master/Child links.
I hope that gives you more detail.
Cheers Scott.
Jack Cowley
Scott -
On tblActionEmployee you do not want to put multiple data into a single field in a record. In other words if the user selects 5 employees from the list box then you want 5 records, not one record with 5 employees initials in a single field/record.
I would suggest you use an Append Query in a command button to append the selected employees to the tblActionEmployee. This will give you are normalized structure and will give each record in the table the correct ActionID
Does this help?
Jack
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.