Carrying values forward.

  • Thread starter Thread starter GA
  • Start date Start date
G

GA

Can someone please help me with my problem.

I want to carry the values of several controls on a form forward to
new records but only if an existing value has changed.

I have to avoid messing up existing data so I though the best way was
for each of the controls that I want to copy I could set a constant in
the 'after update' event for that control and then in the 'on current'
event for the form test for Me.NewRecord and then set the values of
each of the controls from the constants.

I need some help with the code to set the constants and any other
insights with what I am trying to do.

Thanks GA
 
GA said:
Can someone please help me with my problem.

I want to carry the values of several controls on a form forward to
new records but only if an existing value has changed.

I have to avoid messing up existing data so I though the best way was
for each of the controls that I want to copy I could set a constant in
the 'after update' event for that control and then in the 'on current'
event for the form test for Me.NewRecord and then set the values of
each of the controls from the constants.

I need some help with the code to set the constants and any other
insights with what I am trying to do.

Thanks GA

For the controls in question, use their AfterUpdate event to set their
DefaultValue property to their current value.
 
For the controls in question, use their AfterUpdate event to set their
DefaultValue property to their current value.
Thanks for that Baz,

A bit of digging on Dev Ashish's site and I got -

Private Sub ControlName_AfterUpdate()
Const cQuote = """"
Me!ControlName.DefaultValue = cQuote & Me!ControlName.Value & cQuote
End Sub

which works perfectly.
 
GA said:
Thanks for that Baz,

A bit of digging on Dev Ashish's site and I got -

Private Sub ControlName_AfterUpdate()
Const cQuote = """"
Me!ControlName.DefaultValue = cQuote & Me!ControlName.Value & cQuote
End Sub

which works perfectly.

Yep, that's exactly it.
 

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

Back
Top