I am building a db that has a form with a subform that has data on it as well that Im trying to save the records to seperate tables that have relationships.. I have the code writing from the main form to the proper table correctly, but I'm having trouble getting the data from the subform...
I know I'm just having brain loss temporarily can someone give me a kickstart again... I have highlighted the area I need the correct code in red...
Thanks for any help..
Code:
Private Sub savequote_Click()
On Error GoTo Err_savequote_Click
Dim strsql As String
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("tblcontactlist", dbOpenDynaset)
With rst
.AddNew
!LastName = LastName.Value
!FirstName = FirstName.Value
!Address = Address.Value
!City = City.Value
!State = State.Value
!ZIP = ZIP.Value
!HomePhone = HomePhone.Value
!MobilePhone = MobilePhone.Value
!Notes = Notes.Value
!Salesman = Salesman.Value
!customer = "1"
.Update
End With
Set rst = Nothing
Set rst = db.OpenRecordset("tblquotes", dbOpenDynaset)
With rst
.AddNew
!qty = I want to access subform "subfrm6ftprivacy" text box "posts"
!cost = postcost.Value
!saleprice = postsale.Value
!Item = "4x4x8"
.Update
End With
Set db = Nothing: Set rst = Nothing
Me.LastName = ""
Me.FirstName = ""
Me.Address = ""
Me.City = ""
Me.State = ""
Me.ZIP = ""
Me.HomePhone = ""
Me.MobilePhone = ""
Me.Notes = ""
Me.Salesman = ""
Salesman.SetFocus
Exit_savequote_Click:
Exit Sub
Err_savequote_Click:
MsgBox Err.Description
Resume Exit_savequote_Click
End Sub