I have three tables in a database and they are interlinked to each other with foreign keys. I want to do a INSERT query so that I can enter the data. I can insert data to each tables individually but when using foreign key constraint I am getting errors.Here are table relationship and VBA form through which i am trying to enter the data VBA Form,Relationships & Data Types
I am using these two queries as of now but the second one is throwing errors.
sql = "insert into T1(ID,FName,Email)values('" & TextBox1.Text & "', '" & TextBox2.Text & "','" & TextBox3.Text & "')"
sql = "insert into T2(ID,PhoneNumber,City) Values (Select(ID FROM T1 WHERE FName=" & TextBox2.Text & "),'" & TextBox4.Text & "','" & TextBox5.Text & "')"
Please note ID is the main field in my tables and I am to do search,update and delete with that field