1 Replies - 711 Views - Last Post: 12 September 2012 - 09:06 AM Rate Topic: -----

#1 wafers08  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 09-September 12

[problem]adding new data in primary & foreign key table

Posted 09 September 2012 - 09:27 PM

guys ! need help to solve this problem could you guide me

i have this tables

accounts table
accNo - PK (auto increment)
username
password

student table
studentNo - PK (auto increment)
accNo - FK
LName
FName

text1 = username
text2 = password
text3 = FName
text4 = LName

the problem when i click register button
the FName and LName didn't update

Private Sub Command2_Click()
With Adodc1
.Recordset.AddNew
.Recordset!UserName = Text1.Text
.Recordset!Password = Text2.Text
.Recordset!FName = Text3.Text 
.Recordset!LName = Text4.Text
.Recordset.Update
End With

End Sub

Private Sub Form_Load()
On Error Resume Next
Adodc1.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=database.accdb;Persist Security Info=False"
Adodc1.RecordSource = "Select * From register"
Set DataGrid1.DataSource = Adodc1

End Sub



Is This A Good Question/Topic? 0
  • +

Replies To: [problem]adding new data in primary & foreign key table

#2 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 571
  • View blog
  • Posts: 2,979
  • Joined: 19-May 09

Re: [problem]adding new data in primary & foreign key table

Posted 12 September 2012 - 09:06 AM

Hmm. You describe two tables: accounts and student. Then, your recordsource is "select * from register". It would seem that you are working with a different table from the ones you describe. Perhaps that's where your problem is, or perhaps you need to improve your explanation of the problem.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1