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 3850 MMcCarthy 14,534
Recognized Expert Moderator MVP
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?
MMcCarthy 14,534
Recognized Expert Moderator MVP
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.
MMcCarthy 14,534
Recognized Expert Moderator MVP
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 docmd.gotorecord aclast but i did not
|
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 then
double clicks a row on the datasheet subform to open yet another form
bound to a table . These two forms are linked by
the field. So far so good.
|
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 entering data into the subform I get the pencil icon to show data
addition, but underneath the record I am inputting data the record is
blank with a star(*)icon and this is the record(blank)that always gets
saved with all the records that actually have...
|
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 box that is
populated with the code
=subfrm_media_review_sec_party.Form!first_name & " " &
subfrm_media_review_sec_party.Form!last_name
It works except that when I flip through the names it populates the
parent form with the name of what ever...
|
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 its own number
for that row I'd like to use that.
Thanks
DS
| |
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 optional
extra textual information (e.g. "left early due to illness").
The solution I had in mind was:
1) create a presence table, keyed on employee-id and session-id,
containing a 'present' yes/no field and a comment text field;
2) cross-join...
|
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 -- Call Failed." The error message goes on to say that it cannot insert a null value into the column , the foreign key in my subform.
and are in a one-to-one relationship. The data in the main form represents information at an initial state...
|
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 mainform. My subform in the detail section goes blank (this is what I want) but my subform in the footer section appears to have the data from the previous record displayed. When you click on the subform the data dissapears and displays blank. If...
|
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 major
problems for my users though as they are working in this all day. I've
been pounding my head against the wall for the last week trying to get
this figured out.
BACKGROUND
I have an Access 03 DB that is split with the BE on a network...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |