Good Morning,
I have a problem with my access form, it said "You cannot add or change a record because a related record is required in table". I have attached the access file. Please help me. Thanks.
Best Regards,
Yoo
Good Morning,
I have a problem with my access form, it said "You cannot add or change a record because a related record is required in table". I have attached the access file. Please help me. Thanks.
Best Regards,
Yoo
In Relationships, normally you would put the Primary Key value of the 1 side of the relationship in a Foreign Key field of the many side table.
So, What can I do on this access file? Thanks
Can someone help me for this problem in a simple way? The following is the link of my database so you can check for more detailed.
Options:
1. Make StaffNumber the primary key in Staff and eliminate StaffID field
2. Save StaffID in Outstanding
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
I have tried it and it is not working
If you want to save StaffNumber in Outstanding:
1. delete StaffID field
2. delete relationship
3. set StaffNumber in Staff as primary key
4. reset relationship
5. modify the StaffNumber combobox to remove StaffID from RecordSource
6. modify Staff form to eliminate StaffID textbox
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Thank you for your help. However, it is coming error message "The expression On Click you entered as the event property setting produced the following error:Ambiguous name detected:exitbutton_click". it did not go throught. Please help.
I have modified the staff_report file as well. All of the buttons are not working and it did not allow me to add new record. Please help. Thanks.
I don't get any error messages. All buttons work. Record is added.
Why do you have the Add button on Outstanding open a query instead of moving to new record on form, like you do on Staff_Report form? Do not use query to add new records to both tables. Use form/subform arrangement instead.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Thank you for your reply. Is it able to use query to add new records for both tables?
I doubt it if relationship is set to enforce relational integrity. Anyway, I've never tried. Why would you want to?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
I would like to do the seperate add record on query. Firstly, I would add all staff of record on staff record. After that, I will add outstanding record and make the combo box for all staff record and show on screen.
The query is an INNER join of 1-to-many related tables. Change it to RIGHT join and can add records to Outstanding:
SELECT Outstanding.*, Staff.StaffNumber, Staff.LastName, Staff.FirstName, Staff.TeamCode, Staff.StaffNumber FROM Staff RIGHT JOIN Outstanding ON Staff.StaffNumber = Outstanding.Staffnumber
ORDER BY Staff.StaffNumber
WITH OWNERACCESS OPTION;
However, the risk of messing up the Staff data is very high. Allowing data entry/edit directly with tables and queries is poor design.
Much better to use form/subform arrangement.
Should you be saving StaffNumber in Outstanding ApprovalBy field instead of staff name?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Thank you for your reply, I have questions. if I already have staff record on database. I just input the outstanding record on staff record daily and print out the report to give to staff for reference. So, what shall I do. Thanks