How do I copy fields from 1 record to the next?

BearsInNeed

New member
Local time
Yesterday, 23:56
Joined
Aug 6, 2013
Messages
6
I have another problem that drives me insane. And here it goes:
I have fields on a form for the Date, the Start time and the Finish time. These won’t change for the next 120 records. So, upon opening a new record, I’d like the Date and times to appear there already. But here is the crux: After about 120 entries, the date and Time changes, for the next 120 entries. So, once the 'batch' is finished, or I close access, the values do not need to be remembered until I enter a new record.
I copied something like the following from a book and tried running it with various modifications, just for the Date to start with, but no luck. (It did strike me as too simple for something, clearly, as unbelievably TRICKY as my problem...) I did find quite a few posts on this here but none seemed to work for me, or made sense to me in the slightest. (I did mention that I’m a complete rookie, didn’t I?)

Private Sub Acquired_date_AfterUpdate()

Me!Acquired_date.DefaultValue = "'" & Me!Acquired_date.Value & "'"

End Sub


Thanks a bunch in advance!
 
Thank you! But, sorry, uhm, beginner here, you mean this:

******** Code Start **********
const cQuote="""" 'Thats two quotes
me!Control.DefaultValue = cQuote & me!Control.Value & cQuote
'******** Code End **********

I put this:
const Acquired_date=""""
me!Control.DefaultValue = Acquired_date & me!Control.Value & Acquired_date


into the property sheet - Data - Default Value. Nothing happens...
 
Um no, I said to put it in the same event, and you replace "control" with yours:

Private Sub Acquired_date_AfterUpdate()

const cQuote="""" 'Thats two quotes
me!Acquired_date.DefaultValue = cQuote & me!Acquired_date.Value & cQuote

End Sub
 
You Genius, Paul! You wizard! Thank you! You just saved me and others after me a ton of time! And it's for a good cause. Really!
Thank you, thank you, thank you!
 
Last edited:
Happy to help! In real life I'd have the constant declared in a standard module so it available everywhere, but it will certainly work as is.
 
When you have this type of duplication, you probably have a design issue. From your description, it sounds like you need a Batch table to hold the items that are common for the batch.
 
Thank you all, again! (If a little late...)
I did go back to designing and now have related tables and subforms and it went so much quicker because of all the tips and advice i got from everyone!
Thank you!
 

Users who are viewing this thread

Back
Top Bottom