1 Replies - 1922 Views - Last Post: 20 September 2012 - 03:03 PM 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 to tables

Posted 16 September 2012 - 05:25 AM

i have 2 tables with relationship

accounts table
accNo - Primary Key
username
password

students table
studentNo - Primary Key
accNo - Foreign Key
FName
LName

the problem is when i add new data
the students.accNo in not updated

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

Adodc2.Refresh
Adodc3.Refresh

End Sub




i attach my database so you can see my codes clearly

thanks for your help

Is This A Good Question/Topic? 0
  • +

Replies To: [problem] adding new data to tables

#2 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: [problem] adding new data to tables

Posted 20 September 2012 - 03:03 PM

That's because the default recordset type of a data control isn't updatable. Read up on CursorType, LockType, and CursorLocation properties of the ADO recordset.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1