gator said:
does this seem feasible to grab a previous record value?
Private Sub Form_Current()
If Me.CurrentRecord = 1 Then
Cancel = True
Else
DoCmd.GoToRecord acActiveDataObject, , acPrevious
newValue = Me.TranType.Value
DoCmd.GoToRecord acActiveDataObject, , acNext
Me.TranType.Value = newValue
End If
End Sub
No, there is a much easier way to do it, and one that doesn't involve
changing records on the form, with the danger that gives of either forcing a
record-save when you don't want one or maybe having an error because the
current record can't be saved.
Try this instead; it's untested, but it should be close:
'----- start of (untested) code -----
Private Sub Form_Current()
If Me.CurrentRecord > 1 Then
With Me.RecordsetClone
.Bookmark = Me.Bookmark
.MovePrevious
Me.TranType.DefaultValue = Chr(34) & !TranType & Chr(34)
End With
End If
End Sub
'----- end of code -----
I've taken the liberty of changing the effect from actually modifying the
value of TranType each time you go to a new record, to just setting its
default value. That keeps you from dirtying every record just by visiting
it, but fills in the TranType for new records when you make some other
entry. I thought that would be more likely what you wanted, but I could be
wrong. If so, just explain what you're trying to do and why, and I'll give
you some revised code.