Hi I've succeeded to update the tables with this code:
Code:
Private Sub btnCopyMemp_Click()
Dim FPComp, FPPrep As DAO.Recordset
Dim strSQL As String
Set FPComp = CurrentDb.OpenRecordset("FPComplaints", dbOpenDynaset)
If Forms!MempBercMainFrm1!FloraPComplaintWithPreparations.Form.txtTimesRecorded < 0 Then
FPComp.AddNew
FPComp("SpeciesID") = Me![txtSpeciesID]
FPComp("ComplaintID") = Me![txtComplaintID]
FPComp("Complaint") = Me![txtComplaint]
FPComp("TimesRecorded") = 1
FPComp.Update
End If
FPComp.Close
Set FPPrep = CurrentDb.OpenRecordset("FPPreparation", dbOpenDynaset)
FPPrep.AddNew
FPPrep("ComplaintID") = Me![txtComplaintID]
FPPrep("BercMempSpeciesID") = Forms!MempBercMainFrm1.txtSpeciesID
FPPrep("BercMempCompID") = Me![txtComplaintID]
FPPrep("Complaint") = Me![txtComplaint]
FPPrep("Preparation") = Me![txtPrep]
FPPrep("Administration") = Me![txtAdmin]
FPPrep.Update
FPPrep.Close
Set FPComp = Nothing
Set FPPrep = Nothing
End Sub
My problem now is to see the updates on the form - single form - and suform - continuous form. I tried:
Code:
strSQL = "SELECT [SpeciesID], [ComplaintID], [Complaint], [System], [TimesRecorded], [Actions], " & _
"[InformationSource], [ScientificStudies], [MempComplaintID], FPComplaints.[BercComplaintID] " & _
"FROM FPComplaints Where [ComplaintID] = " & Me![txtComplaintID].Value
DoCmd.RunSQL strSQL
but I understand runSQL is only for action sql statments.
So what would be the best way for me to update these 2 forms?
Also appreciate any comments on the update code above - I think there might have been a simpler way to do it?
Thanks for any help
David