ник: Алексей
Sub вводдат ()
Dim d, v, dv As String
Dim dd As Date
Dim rst As Recordset
Dim q As Variant
Set rst = CurrentDb.OpenRecordset("Архив")
d = InputBox("Введите дату", "Дата")
v = InputBox("Введите время", "Время")
dv = d + " " & v
dd = CDate(dv)
temp = MsgBox(dv, vbOKOnly, "Правильность склеивания")
rst.Move 1
Do Until rst.EOF
pp = Abs(dd - rst.Fields(1))
rst.MovePrevious
gg = Abs(dd - rst.Fields(1))
rst.MoveNext
If pp < gg Then aa = rst.Fields(1)
rst.MoveNext
Loop
temp = MsgBox(aa, vbOKOnly, "aa")
End Sub