1

Topic: Value by default from the previous record

Good afternoon. Access 2016. In the table three columns: "the Key field", "Date" (coincidence is not admitted, by default - leaking) and "Money". It is necessary, that at creation of new record, in the field "Money" by default there was a previous value (value for the previous date).

2

Re: Value by default from the previous record

ldnick1972;
Function Dmax

3

Re: Value by default from the previous record

sdku;
Not that I do Something: =DMax ("[Money]"; "[NazvanieTablitsy]"), and at saving "Unknown function DMax in condition expression on value or in value by default for ' NazvanieTablitsy. Money '"

4

Re: Value by default from the previous record

Oldnick1972;
I ask pardons-make so:

Private Sub Form_Current ()
Dim rs As Recordset
If Me. NewRecord Then
Set rs = CurrentDb. OpenRecordset ("select top 1 money from 1 order by date desc")
Me. = rs! Money
End If
End Sub

5

Re: Value by default from the previous record

sdku, thanks, all earned