I made a post some time ago but have made a number of changes to the database.
I have a form (frmCheckInLatest) to extend a guest
I made a post some time ago but have made a number of changes to the database.
I have a form (frmCheckInLatest) to extend a guest

This month, every Windows Secrets subscriber can download a one-chapter excerpt of Windows 7: The Missing Manual.Windows 7: The Missing Manual provides valuable information to help you overcome these difficulties in learning a new operating system. Subscribe today to download your free excerpt.
If you're already looking at the previous record in your AutoFillNewRecord function, then you should be able to recalculate the Checkout date for that record and set the [RentBegDate] for the new record to the value of that calculation. If you have trouble figuring it out, post the code for the AutoFillNewRecord function and someone will be able to help with the details.
Charlotte
My AutoFillNewRecord (F As Form) function came from Microsoft knowledge base (Q210236). I have an invisible text box that has the DefaultValue set for the fields that I want to fill in the new record. FrmCheckInLast has the OnCurrent property set for =AutoFillNewRecord([Forms]![frmCheckInLast])
ModAuto_Fill_New_Record is as follows:
Option Compare Database
Option Explicit
Function AutoFillNewRecord(F As Form)
Dim RS As DAO.Recordset, C As Control
Dim FillFields As String, FillAllFields As Integer
On Error Resume Next
'Exit if not on the new record.
If Not F.NewRecord Then Exit Function
'Goto the last record of the form recordset to autofill form)
Set RS = F.RecordsetClone
RS.MoveLast
'Exit if you cannot move to last record (no records).
If Err <> 0 Then Exit Function
'Get the lost of fields to autofill.
FillFields = ";" & F![AutoFillNewRecordFields] & ";"
'If there is no criterioa field, then set flag indicating All
'fields should be autofilled.
FillAllFields = Err <> 0
F.Painting = False
'Visit eadch field on the form.
For Each C In F
'Fill the field if ALL fields are to be filled OR if the
'...ControlSource field can be found in the FillFields list.
If FillAllFields Or InStr(FillFields, ";" & (C.Name) & ";") > 0 Then
C = RS(C.ControlSource)
End If
Next
F.Painting = True
End Function
************************************************** **********
The [CheckOutDate3] date is displayed on the last rental record.
Omit RentBegDate from the string in FillFields, and add the following to your function.
If F.Name = "frmCheckInLast" Then
F("RentBeginDate") = RS("CheckOutDate3")
End If
If CheckOutDate3 is not calculated in the record source of the form, but in the control source of a control on the form, you must calculate it here too:
F("RentBeginDate") = DateAdd("y",RS("NumberofDays"),RS("RentBegDate"))
Hans,
Many thanks! Works like a charm.
Tom