Update using data controls [message #100616] |
Fri, 07 March 2003 11:10 |
s l
Messages: 4 Registered: February 2003
|
Junior Member |
|
|
I'm working on a VB produced frontend designed to access a MSAccess db. Now I've moved over to an Oracle 9i db and can't seem to add new records. Heres' the code with added comments:
' DataEnvironment1 = DataEnvironment
' rsAllRecordsUsers = recordset
' Update db with data from form
DataEnvironment1.rsAllRecordsUsers.Update
' Using MSAccess, the recordset would now contain the
' primary keys generated by the db for the new record.
' Now determine primary keys for insertion as
' foreign keys
lngRecordNumber =
DataEnvironment1.rsAllRecordsUsers.Fields("records_id")
lngUserID = DataEnvironment1.rsAllRecordsUsers.Fields("users_id")
' Insert foreign keys into recordset
DataEnvironment1.rsAllRecordsUsers.Fields("records_id").Value = lngRecordNumber
DataEnvironment1.rsAllRecordsUsers.Fields("RecordOwner").Value = lngUserID
' Update record with foreign keys. Record should
' be complete.
DataEnvironment1.rsAllRecordsUsers.Update
But here is the problem, lngUserID and lngRecordNumber both contain 0, and the last update leaves rows with no foreign keys. Any ideas about what I'm missing or how I can fix this?
Thanks
Scott
|
|
|
|