Hi, im kinda new with record sets and i hope you can help me out with this. i have a form with multiple text boxes - i want to take the info from the different text boxes and place them into different tables....
ie txtbox1 info goes to table 1 and txtbox2 info goes to table2
the problem is table1 is has a relation with table2 and when i try to update table2 i get an error saying i can't b/c a related record is needed in table2
this is my code thus far and the 1st with statement will work fine...but what about the 2nd??
Dim db As Database
Dim rstcaldata As Recordset
Dim rstcalhist As Recordset
Dim rstcalspecs As Recordset
Dim rstcalequip As Recordset
Dim criteria As String
Set db = CurrentDb()
Set rstcaldata = db.OpenRecordset("tblCalData", dbOpenTable)
Set rstcalhist = db.OpenRecordset("tblCalHistory", dbOpenTable)
Set rstcalspecs = db.OpenRecordset("tblSpecs", dbOpenTable)
Set rstcalequip = db.OpenRecordset("tblCalEquip", dbOpenTable)
With rstcalequip
.AddNew
![AssetNo] = Me.txtAssetNo
![SerialNo] = Me.txtSerialNo
![ModelNo] = Me.txtModelNo
![StatusNo] = Me.cboStatusNo
![FamilyNo] = Me.cboFamilyNo
![Description] = Me.txtDescription
.Update
End With
With rstcaldata
.AddNew
![CalCycle] = Me.txtCalCycle
.Update
End With
Thanks...
Topher
ie txtbox1 info goes to table 1 and txtbox2 info goes to table2
the problem is table1 is has a relation with table2 and when i try to update table2 i get an error saying i can't b/c a related record is needed in table2
this is my code thus far and the 1st with statement will work fine...but what about the 2nd??
Dim db As Database
Dim rstcaldata As Recordset
Dim rstcalhist As Recordset
Dim rstcalspecs As Recordset
Dim rstcalequip As Recordset
Dim criteria As String
Set db = CurrentDb()
Set rstcaldata = db.OpenRecordset("tblCalData", dbOpenTable)
Set rstcalhist = db.OpenRecordset("tblCalHistory", dbOpenTable)
Set rstcalspecs = db.OpenRecordset("tblSpecs", dbOpenTable)
Set rstcalequip = db.OpenRecordset("tblCalEquip", dbOpenTable)
With rstcalequip
.AddNew
![AssetNo] = Me.txtAssetNo
![SerialNo] = Me.txtSerialNo
![ModelNo] = Me.txtModelNo
![StatusNo] = Me.cboStatusNo
![FamilyNo] = Me.cboFamilyNo
![Description] = Me.txtDescription
.Update
End With
With rstcaldata
.AddNew
![CalCycle] = Me.txtCalCycle
.Update
End With
Thanks...
Topher