Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention. Check out this how-to article for more information.
Public Sub CopyLocPTDiag(ByVal POldID As Long, ByVal PNewID As Long) Dim rsOld As DAO.Recordset Dim rsNew As DAO.Recordset Set OldDb = DBEngine.Workspaces(0).OpenDatabase("C:\Documents and Settings\rpazmino\Desktop\Migration-Module\Patient data.mdb") Set rsOld = OldDb.OpenRecordset("SELECT * FROM [Locations of Primary Tumors at Diagnosis] WHERE [Patient Number] = " & POldID) Set rsNew = CurrentDb.OpenRecordset("TumorLocationDetails") 'Iterate through records from old table Do While rsOld.EOF = False 'Add record into new table rsNew.AddNew LocID = LocID + 1 'Copy values over rsNew!TumorLocationID = LocID rsNew!PatientID = PNewID rsNew!Event = "Diagnosis" rsNew!TumorType = "Primary Tumor" If rsOld.RecordCount > 1 Then rsNew!TumorLocation = "Multiple" Exit Do Else rsNew!TumorLocation = rsOld![Location of Primary Tumor at Diagnosis] End If 'Save rsNew.Update rsOld.MoveNext Loop rsOld.Close rsNew.Close End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.