Adding Parent Record if None Exists in Microsoft Access

preview_player
Показать описание
In this Microsoft Access tutorial I will show you how to automatically add a parent record if the user tries to add a child record in a subform first thus preventing an orphan. We will automatically add an order record if the user starts adding an order detail record and the order doesn't exist yet. We will then set up referential Integrity to prevent future orphan records if the user deletes the order.

LEARN MORE:

PRE-REQUISITES:

LINKS:

RECOMMENDED COURSE:

THE CODE:
' In the OrderDetailF subform:
Private Sub Form_BeforeInsert(Cancel As Integer)
If IsNull(Parent!OrderID) Then
Parent!OrderDate = Date
Parent.Refresh
End If
End Sub

BECOME A MEMBER:

FREE TEMPLATE DOWNLOADS:

ADDITIONAL RESOURCES:

KEYWORDS:
access 2016, access 2019, access 2021, access 365, microsoft access, ms access, ms access tutorial, #msaccess, #microsoftaccess, #help, #howto, #tutorial, #learn, #lesson, #training, #database, automatically add parent record, Check if Record Exists if not add it, Adding parent records, Preventing orphan records, Automatically adding parent records, Referential Integrity, prevent deletion
Рекомендации по теме
Комментарии
Автор

I am always happy, my mind at ease when ever you say " little vba" you teach with simplicity.

akokohjoel
Автор

Hi Richard this video was very interesting thanks Steve b

stephenbeswick