Dim rstX As ADODB.Recordset Set rstX = New ADODB.Recordset rstX.CursorLocation = adUseClient ctQuery = "Select * from Patients where mpinumber = '" & Trim(sLookUpID) & "'" rstX.Open ctQuery, "Provider=MSDASQL.1;UID=ctore;pwd=cqi$$;Data Source=ctore", adOpenKeyset, adLockOptimistic rstX.MoveLast iRecords = rstX.RecordCount If iRecords > 0 Then ' Update record with stuff from message rstX.MoveFirst rstX!LastName = mPID.PatientName.FamilyName.Value rstX!Firstname = mPID.PatientName.GivenName.Value rstX.Update Else ' Insert Record MsgBox ("New Record") End If rstX.Close