Repeating Entries

I

Ian

I'm creating a database with client info for the main
table and services as a sub. One client may purchase the
same service 10x. I don't want to have to enter the same
details in every time so is there a way to make the next
entry (in the services subtable) repeat the entry from
above it? I've seen it in db's with control enter.

Thanks.
 
T

Todd Shillam

Ian,

If you've built a form to enter data, use the field's OnGotFocus event.
Copy, paste, and edit the following code:


'FETCHING DEFAULT VALUE FROM PREVIOUS RECORD
Dim rs As Object
Set rs = Me.RecordsetClone

If rs.EOF Or Not Me.NewRecord Then
' DON'T DO ANYTHING IF NO PREVIOUS RECORD EXIST OR NOT NEW
RECORD
Else
With rs

.MoveLast

Me![YourFieldNameHere] = .Fields("YourFieldNameHere")

End With

End If

When you tab over to the field, it will default to the previous record's
value.

Best regards,

Todd
 
Top