Main Form -Subform Required Entries

Ilovexfiles

Registered User.
Local time
Today, 07:59
Joined
Jun 27, 2017
Messages
37
Hello
Not sure if this is possible.

I have a Main Form.
That Main Form has a Subform.
That Subform has a Subform.

They are based on tables and linked by their Id's.

Currently, users are able to enter into the Main Form and create a new entry, without having to enter anything into Subform 1.

I would like to require users that when they create a new entry on the Main Form, they move to the Subform and start a new record there too.

Is this possible? I've tried various form events coding with no luck. Event Unload worked except it would require Subform1 entry even if they did NOT create a new entry into Main Form, which was an issue. That was the closest I got to the solution.

Thanks
 
I thought I figured it out, but No! The below doesn't work because I made the Unique/Foreign IDs required for my tables so it will not create a record in subform before creating one in the main form. Is there another way around this? I want to keep Id's required, I do not want accidental random records floating around.

Is there a way to prevent the closing of the window if (Me!frmScreeningAICLog.Form!Screener) is Null?

Private Sub Form_BeforeInsert(Cancel As Integer)
If IsNull(Me!frmScreeningAICLog.Form!Screener) Then
Forms!frmClientAICLog!frmScreeningAICLog.SetFocus
Forms!frmClientAICLog!frmScreeningAICLog.Form![Screener].SetFocus
MsgBox "Please enter RAIC-BH first"
End If
End Sub
 
What do you want to happen if the usersimply refuses to enter a Record in Sub1? Do you want the Main Form Record deleted?

You say that you not wanting a Sub1 Record created if no Main Form Record exists...if your Main Form/Subform is set up correctly, i.e. is related using the Subform's Master Link/Child Link proprties,
Access automatically prevents that!
 
What do you want to happen if the usersimply refuses to enter a Record in Sub1? Do you want the Main Form Record deleted?

You say that you not wanting a Sub1 Record created if no Main Form Record exists...if your Main Form/Subform is set up correctly, i.e. is related using the Subform's Master Link/Child Link proprties,
Access automatically prevents that!


Hi
I want the form to not allow closure of the form itself until they enter 1 particular field in Sub1.

Main Form = tblClient, ClientID
Sub1 = tblScreener, Screener ID & ClientID; linked to Main Form by Client ID
Sub2 = tblAdmit, AdmitID, ScreenerID, & ClientID; linked to Sub1 by ScreenerID and ClientID.

Sub1 and Sub 2 are set up the way I want, because tblAdmit has ScreenerID "required" on the table itself.

Access currently however allows user to close the Main Form with a new record on Main Form/tblClient but no new/corresponding record on Sub1/tblScreener.

Thanks
 

Users who are viewing this thread

Back
Top Bottom