Copy previous record fields into new record form fields (1 Viewer)

You're getting advice on how to work around the problem of an unnormalized schema. If you want to build a better foundation, please start a new thread with that as a goal so we can be clear what we are trying to do and we are not offering contradictory solutions.
 
You're getting advice on how to work around the problem of an unnormalized schema. If you want to build a better foundation, please start a new thread with that as a goal so we can be clear what we are trying to do and we are not offering contradictory solutions.

Hi Pat,
I was thinking the same thing. I opened a new thread in the TABLES forum called Table Design & Relationships to pursue the disorganized tables.
This thread will remain limited to copying data to a new record.
Thank you.
 
No. I said to scrap the before update event entered by mistake

Code:
Option Compare Database
Option Explicit

Private Sub Product Line_AfterUpdate()
Me.[Product Line].DefaultValue = "'" & Me.[Product Line] & "'"
End Sub

Thank you for the clarification. It helps my understanding. I typed the code exactly as you provided and get an error message. "Compile error. Expected end of statement."
Attached are a couple of images showing the info entered (Capture1) and the error message (Capture2).
Any help to fix this is appreciated.
Thank you.
 

Attachments

  • Capture1.jpg
    Capture1.jpg
    94 KB · Views: 159
  • Capture2.JPG
    Capture2.JPG
    85.3 KB · Views: 165
For reference - do not use field or object names with embedded spaces - to avoid syntax errors that will materialize sooner or later.
 
Sorry. As already pointed out, the issue was the embedded space in Product Line. The code should have an underscore as shown in RED below

Code:
Option Compare Database
Option Explicit

Private Sub Product[B][COLOR="Red"]_[/COLOR][/B]Line_AfterUpdate()
Me.[Product Line].DefaultValue = "'" & Me.[Product Line] & "'"
End Sub
 
If you don't mind spending some time to copy paste some Code, try this link for duplicating fields from previous record: https://www.msaccesstips.com/2012/02/duplicating-fields-with-conditional.html

Hi apr
That's a neat use of the tag property. Just added to your rep points!

If its OK with you, I'd like to add a link to that webpage from a similar item on my website where I use the tag property to set the visible/hidden, enable/disabled, locked/unlocked state of a group of controls at once

EDIT
Your site would also be a useful addition to this webpage Useful links. Is that also OK with you?
 
Last edited:
Hi apr
That's a neat use of the tag property. Just added to your rep points!

If its OK with you, I'd like to add a link to that webpage from a similar item on my website where I use the tag property to set the visible/hidden, enable/disabled, locked/unlocked state of a group of controls at once
See http://www.mendipdatasystems.co.uk/set-controls/4594398114

EDIT
Your site would also be a useful addition to this webpage Useful links. Is that also OK with you?



Ok, I will add your link to my Website.


Sent from my iPhone using Tapatalk
 
Hi apr
Thanks for that as well. I'll update my website accordingly later.
 
Hi apr
That's a very quick way of adding useful links! Wish I'd thought of that :cool:

Now added links to your site on the following pages:

I think that covers it!
 
Last edited:



Hi isladogs,

Sure it does. Thanks a lot.


Sent from my iPhone using Tapatalk
 

Users who are viewing this thread

Back
Top Bottom