Ooops... the prior post was done using Recordsetclone (and yes, it does work
well), but I find the following method more precise. You can see what works
best for you (SOAP is a table in one of my databases in use at my office):
Private Sub Command63_Click()
On Error GoTo command63err
Dim dbs As Database
Dim rst As Recordset
Dim ii As Long
ii = Forms![*Medical Information]![EmbMedicalInfo].Form![SOAP].Form![ACCT]
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("SELECT SOAP.* FROM SOAP WHERE ([ACCT]= " & ii &
") ORDER BY SOAP.DDate;", dbOpenDynaset)
With rst
.MoveFirst
.MoveLast
If [S:] <> " " Then
MsgBox "Please change the date so that your new record is at" &
Chr(13) & "the end of recordset! (order is by descending dates)" & Chr(13) &
"Also: your HPI field must be blank.", vbExclamation
Exit Sub
End If
.MovePrevious
oo = IIf(IsNull(![S:]), " ", ![S:])
rr = IIf(IsNull(![A5].value), " ", ![A5])
ss = IIf(IsNull(![OtherA]), " ", ![OtherA])
tt = IIf(IsNull(![ROS]), " ", ![ROS])
uu = IIf(IsNull(![O]), " ", ![O])
vv = IIf(IsNull(![A1]), " ", ![A1])
ww = IIf(IsNull(![A2]), " ", ![A2])
XX = IIf(IsNull(![A3]), " ", ![A3])
yy = IIf(IsNull(![A4]), " ", ![A4])
zz = IIf(IsNull(![P]), " ", ![P])
.MoveNext
.Edit
![S:] = oo
![A5] = rr
![OtherA] = ss
![ROS] = tt
![O] = uu
![A1] = vv
![A2] = ww
![A3] = XX
![A4] = yy
![P] = zz
.UPDATE
.Close
End With
Me.Refresh
Exit Sub
command63err:
MsgBox "An error has occurred! Make sure that the" & Chr(13) & "((copy to
record)) is the last record on the list." & Chr(13) & "Then try again.",
vbCritical
Exit Sub
End Sub