We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
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.
|Update Table via VBA SQL with multiple criteria||2||59|
|Need help creating a nested folder using MS Access and the Outlook Object Module||3||38|
|Excel graph in access report||1||25|
|how to get hundreds part from the number||1||23|
Join the community of 500,000 technology professionals and ask your questions.