Connecting Tech Pros Worldwide Help | Site Map

how do you get data fields to carry over to a new record?

Newbie
 
Join Date: Jun 2007
Posts: 5
#1: Jun 5 '07
Is there a simple way, without setting up a module, to get certain data fields to carry over to a new record as well in MS Access 2003. I've tried alot of modifications to the "default value" but none of them seem to work.

If anyone can help me out it would be greatly appreciated.
ADezii's Avatar
Expert
 
Join Date: Apr 2006
Location: Philadelphia
Posts: 5,214
#2: Jun 5 '07

re: how do you get data fields to carry over to a new record?


Quote:

Originally Posted by wavbuser

Is there a simple way, without setting up a module, to get certain data fields to carry over to a new record as well in MS Access 2003. I've tried alot of modifications to the "default value" but none of them seem to work.

If anyone can help me out it would be greatly appreciated.

  1. Do you want ALL Fields carried over to the New Record or selective ones?
  2. Do you want these values automatically transferred over to the New Record, or when you enter these Fields?
  3. Once data is entered into a Field, does it become the new default Value for that Field?
Rabbit's Avatar
Expert
 
Join Date: Jan 2007
Location: California
Posts: 3,835
#3: Jun 5 '07

re: how do you get data fields to carry over to a new record?


Quote:

Originally Posted by wavbuser

Is there a simple way, without setting up a module, to get certain data fields to carry over to a new record as well in MS Access 2003. I've tried alot of modifications to the "default value" but none of them seem to work.

If anyone can help me out it would be greatly appreciated.

Does this table have a unique field that increments for each record added?
If it does then you can use a DMax embedded in a DLookup.
Newbie
 
Join Date: Jun 2007
Posts: 5
#4: Jun 5 '07

re: how do you get data fields to carry over to a new record?


Quote:

Originally Posted by ADezii

  1. Do you want ALL Fields carried over to the New Record or selective ones?
  2. Do you want these values automatically transferred over to the New Record, or when you enter these Fields?
  3. Once data is entered into a Field, does it become the new default Value for that Field?

Sorry for being unclear before:

I only need selective fields to be carried over, not all.

I'm actually using a form so, when the user decides to insert a new record, I want certain fields from the previous record to carry over.

Yes, once the values in the selective fields are modified on the form, i want those value to become the new default values.
Newbie
 
Join Date: Jun 2007
Posts: 5
#5: Jun 5 '07

re: how do you get data fields to carry over to a new record?


Quote:

Originally Posted by Rabbit

Does this table have a unique field that increments for each record added?
If it does then you can use a DMax embedded in a DLookup.

No, unfortunately the records do not have any fields like that.
Rabbit's Avatar
Expert
 
Join Date: Jan 2007
Location: California
Posts: 3,835
#6: Jun 5 '07

re: how do you get data fields to carry over to a new record?


You'll probably have to add one then, unless ADezii has another idea.
Newbie
 
Join Date: Jun 2007
Posts: 5
#7: Jun 5 '07

re: how do you get data fields to carry over to a new record?


Ok i've found that solution for those of you with a similar problem, google "previous record" instead of "carry over", it works alot better, anyways, i found the solution in another forum there.

http://www.thescripts.com/forum/thread203454.html

incase it doesnt work here is the main thing you need:

Quote:
It *is* a field property.

In the AfterUpdate event of the control (let's say it is called
theValue), put

theValue.defaultvalue = theValue.value

If theValue is text, do this:

theValue.defaultvalue = "'" & theValue.value & "'"
http://www.thescripts.com/forum/thread203454.html
Rabbit's Avatar
Expert
 
Join Date: Jan 2007
Location: California
Posts: 3,835
#8: Jun 5 '07

re: how do you get data fields to carry over to a new record?


Quote:

Originally Posted by wavbuser

Ok i've found that solution for those of you with a similar problem, google "previous record" instead of "carry over", it works alot better, anyways, i found the solution in another forum there.

http://www.thescripts.com/forum/thread203454.html

incase it doesnt work here is the main thing you need:



http://www.thescripts.com/forum/thread203454.html

This solution uses a code module which is what you wanted to avoid in the first place.
ADezii's Avatar
Expert
 
Join Date: Apr 2006
Location: Philadelphia
Posts: 5,214
#9: Jun 5 '07

re: how do you get data fields to carry over to a new record?


Quote:

Originally Posted by wavbuser

Sorry for being unclear before:

I only need selective fields to be carried over, not all.

I'm actually using a form so, when the user decides to insert a new record, I want certain fields from the previous record to carry over.

Yes, once the values in the selective fields are modified on the form, i want those value to become the new default values.

Only a couple of lines of Code will do the trick for you.
  1. For each Control that you wish to carry over its value, set the Control's Tag Property to Carry.
  2. Place this code in the AfterUpdate() Event of the Form.
  3. For each Control that you elected to carry over, set its Tag Property to Carry, its Default Value will be reset and will subsequently appear in New Record mode.
  4. Let me know how you make out with this.
Expand|Select|Wrap|Line Numbers
  1. Dim ctl As Control
  2.  
  3. For Each ctl In Me.Controls
  4.   If ctl.Tag = "Carry" Then
  5.     ctl.DefaultValue = "'" & ctl.Value & "'"
  6.   End If
  7. Next
ADezii's Avatar
Expert
 
Join Date: Apr 2006
Location: Philadelphia
Posts: 5,214
#10: Jun 5 '07

re: how do you get data fields to carry over to a new record?


Quote:

Originally Posted by wavbuser

Ok i've found that solution for those of you with a similar problem, google "previous record" instead of "carry over", it works alot better, anyways, i found the solution in another forum there.

http://www.thescripts.com/forum/thread203454.html

incase it doesnt work here is the main thing you need:



http://www.thescripts.com/forum/thread203454.html

Be advised that this approach does not take into consideration the carrying over of values for 'selective' Controls, see my response in Message #9.
FishVal's Avatar
Expert
 
Join Date: Jun 2007
Location: Israel
Posts: 2,584
#11: Jun 6 '07

re: how do you get data fields to carry over to a new record?


Quote:

Originally Posted by ADezii

Be advised that this approach does not take into consideration the carrying over of values for 'selective' Controls, see my response in Message #9.

Why?

This is an Expression handler of AfterUpdate event on a particular control.
Thus it is very selective by its nature and it fits the need "not to create module". Personally I prefer coding but I'm really appreciating this simple and elegant solution.

:)
Rabbit's Avatar
Expert
 
Join Date: Jan 2007
Location: California
Posts: 3,835
#12: Jun 6 '07

re: how do you get data fields to carry over to a new record?


Quote:

Originally Posted by FishVal

Why?

This is an Expression handler of AfterUpdate event on a particular control.
Thus it is very selective by its nature and it fits the need "not to create module". Personally I prefer coding but I'm really appreciating this simple and elegant solution.

:)

Problem is that their solution doesn't work unless it's in the form's code module.
FishVal's Avatar
Expert
 
Join Date: Jun 2007
Location: Israel
Posts: 2,584
#13: Jun 6 '07

re: how do you get data fields to carry over to a new record?


Quote:

Originally Posted by Rabbit

Problem is that their solution doesn't work unless it's in the form's code module.

Big deal. A good village is burning beautifully.
Of course this doesn't work. Long live VBA. :)
Rabbit's Avatar
Expert
 
Join Date: Jan 2007
Location: California
Posts: 3,835
#14: Jun 6 '07

re: how do you get data fields to carry over to a new record?


Quote:

Originally Posted by FishVal

Big deal. A good village is burning beautifully.
Of course this doesn't work. Long live VBA. :)

lol, I have no problem with VBA. It's just that the poster originally wanted to avoid VBA.
Reply


Similar Microsoft Access / VBA bytes