One form to update Two tables ID

nashfaq

Registered User.
Local time
Today, 20:49
Joined
Oct 17, 2018
Messages
28
Hi Team

i am new, i have Two Table
PersonalDetails (Code, Name, Contact) and
other Table EducationDetaits (Code, Degree)

i want to have a form that will populate "Code" in both tables.

can you please help me how can i do that.

Code is primary Key in Both Tables.

kindly suggest
Regards
Nasir
 
here is a sample to begin with.
 

Attachments

Hi freind

but i dont need any sub form...
Also my relation is ONE to ONE.
Code is Primaty Key in Both Tables.


kindly suggest.

regards
Nasir
 
I find it hard to create the form you need.
there is subform in the attached.
but now it appears as if it is a textbox.
only one degree can be entered to it (1 on 1).
 

Attachments

That sounds like a poor design. It should be a one to many relationship.
What happens when a person has a second degree ?

Arne's original subform design is perfect for this.
 
Hi arnelgp

thanks for help, i will design my form as i required,

the relation is ONE to ONE, degree is just a case i mention for explaining my requirement.

thanks again.

Regards
Nasir
 
here is a sample to begin with.

hi Arnelgp

please explain the below code your used.

Private Sub Form_Current()
On Error Resume Next
If Me.NewRecord And Screen.ActiveControl.Name = "Degree" Then
Me.Code.SetFocus
End If
End Sub

Private Sub Form_BeforeInsert(Cancel As Integer)
Cancel = Trim(Me.Parent!Code & "") = ""
If Not Cancel Then Cancel = DCount("*", "EducationalDetails", "Code=""" & Nz(Me.Parent!Code, "0") & """") <> 0

End Sub

regards
Nasir
 

Users who are viewing this thread

Back
Top Bottom