Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: updates using data controls


Message #1 by "Scott L" <bangorme@h...> on Fri, 7 Mar 2003 18:20:18
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

  Return to Index