Repeating Entries

  • Thread starter Thread starter Ian
  • Start date Start date
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.
 
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
 
Ian said:
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.

You may also want to consider your table structure. It sounds like you
need to do another level of normalization with a new table with the repeated
data.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top