Hello,
I'm hoping someone can help me. I have a mainform based on a table (let's call it tblMain) with a Primary Key of [ID]. There is a subform on this main form based on another table (let's call it tblSub). There is a foreign key field in tblSub called [Master ID]. The Primary and Foreign keys are in a One-to-One relationship i.e. for each record in tblSub, there will be exactly one record in tblSub.
I am having a problem where when I add a new record in the main form, a record is added in tblSub with a blank [Master ID] field. If I set the required property on the [Master ID] field in tblSub to Yes, I get error messages. (You cannot add or change a record because a related record is required...). If I take out the default value for this field, I get "The field cannot contain a null value because the Required property for this field is set to True.
This is only a problem on new records. If I go into existing records in the main form, everything appears to work fine. I have the "Link Child Fields" and "Link Master Fields" on the subform set correctly. Any ideas?
Thanks,
Josh
5 3836
Hi Josh
Open the relationships window. Click on the link between the two tables (put the no duplicates back on [Master ID] first. Now tick all the cascading boxes and click ok. Do you get any errors.
Mary
Hello,
I'm hoping someone can help me. I have a mainform based on a table (let's call it tblMain) with a Primary Key of [ID]. There is a subform on this main form based on another table (let's call it tblSub). There is a foreign key field in tblSub called [Master ID]. The Primary and Foreign keys are in a One-to-One relationship i.e. for each record in tblSub, there will be exactly one record in tblSub.
I am having a problem where when I add a new record in the main form, a record is added in tblSub with a blank [Master ID] field. If I set the required property on the [Master ID] field in tblSub to Yes, I get error messages. (You cannot add or change a record because a related record is required...). If I take out the default value for this field, I get "The field cannot contain a null value because the Required property for this field is set to True.
This is only a problem on new records. If I go into existing records in the main form, everything appears to work fine. I have the "Link Child Fields" and "Link Master Fields" on the subform set correctly. Any ideas?
Thanks,
Josh
Hi Josh
Open the relationships window. Click on the link between the two tables (put the no duplicates back on [Master ID] first. Now tick all the cascading boxes and click ok. Do you get any errors.
Mary
Hi Mary,
I did as you asked. The boxes were already checked. I also tried taking out the Required property on [Master ID]. This still results in new records with a blank [Master ID] field. With non-new records, there is no problem. The records are created in the sub form just as they are supposed to with tehe [Master ID] field linked to the main table's [ID] field. Any other ideas?
Hi Mary,
I did as you asked. The boxes were already checked. I also tried taking out the Required property on [Master ID]. This still results in new records with a blank [Master ID] field. With non-new records, there is no problem. The records are created in the sub form just as they are supposed to with tehe [Master ID] field linked to the main table's [ID] field. Any other ideas?
It's very strange and shouldn't be happening.
1. Is the [Master ID] field on the subform (hidden is fine)?
2. Check the control source property of [Master ID] field ?
Mary
It's very strange and shouldn't be happening.
1. Is the [Master ID] field on the subform (hidden is fine)?
2. Check the control source property of [Master ID] field ?
Mary
No, it was not. Neither was the [ID] field on the mainform. Once I added, them, it worked fine. I didn't think it was necessary to have those fields on the forms. Thank you for your help.
No, it was not. Neither was the [ID] field on the mainform. Once I added, them, it worked fine. I didn't think it was necessary to have those fields on the forms. Thank you for your help.
You're Welcome.
The join field has to be on both the forms but they can be made invisible if you don't want the user to see them.
Mary
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Alain Guichaoua |
last post by:
Good evening to all
Here is my problem :
I have a form with a subform. They are linked.
When I open the form I would like the subform to reach its last
record.
I tried the method...
|
by: William Wisnieski |
last post by:
Hello Everyone,
Access 2000,
I have a main unbound form with a bound datasheet subform
. The subform is bound to a query
that returns records based on criteria in the main form. The user...
|
by: Joe Scully |
last post by:
Hi all,
I am having trouble with access adding a blank record to a subform
everytime I finish entering data and closing the form. (The form and
subform are based on the one table)
When...
|
by: tdmailbox |
last post by:
I have a form with a child form. In the child form there is a list of
names that can grow quite large. On the parent form I want to display
the first name from the child form. I set up a test...
|
by: DS |
last post by:
Whenever you use a continous form each row represents a record. Does
this record have a number? If so how do you access it. Right now I
have a field using auto number. But if access generates...
|
by: Stephen Poley |
last post by:
I have the following situation:
- a table of employees, keyed on employee-id;
- a table of training sessions, keyed on session-id;
- a requirement to log who was present at which session, plus...
|
by: jpatchak |
last post by:
Hello,
I have a form with a subform. The mainform has a primary key () and the subform has a foreign key (). When new records are added in the mainform, I get an error message that says, "ODBC...
|
by: FNA access |
last post by:
I have a mainform that has a subform in the detail section and a subform in the footer section.(Both subforms are in datasheet view) When I click the navigation button to create a new record on the...
|
by: Andy_Khosravi |
last post by:
I'm having issues with updates being blocked due to some sort of
record locking issue. The error does not occur consistently, so I've
had a hard time nailing it down. It does happen enough to cause...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |