MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.
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
|Getting Run-time error 91 - Object Variable or With Block Variable not set||20||33|
|Access Crosstab Query with Multiple Values||4||31|
|Column Layout in Access Xp VBA Report||3||18|
|Binding recordsets to a form||6||21|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
11 Experts available now in Live!