how do you get data fields to carry over to a new record? | Newbie | | Join Date: Jun 2007
Posts: 5
| | |
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.
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia
Posts: 5,214
| | | 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. - Do you want ALL Fields carried over to the New Record or selective ones?
- Do you want these values automatically transferred over to the New Record, or when you enter these Fields?
- Once data is entered into a Field, does it become the new default Value for that Field?
|  | Expert | | Join Date: Jan 2007 Location: California
Posts: 3,835
| | | 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
| | | re: how do you get data fields to carry over to a new record? Quote:
Originally Posted by ADezii - Do you want ALL Fields carried over to the New Record or selective ones?
- Do you want these values automatically transferred over to the New Record, or when you enter these Fields?
- 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
| | | 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.
|  | Expert | | Join Date: Jan 2007 Location: California
Posts: 3,835
| | | 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
| | | 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
|  | Expert | | Join Date: Jan 2007 Location: California
Posts: 3,835
| | | 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.
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia
Posts: 5,214
| | | 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. - For each Control that you wish to carry over its value, set the Control's Tag Property to Carry.
- Place this code in the AfterUpdate() Event of the Form.
- 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.
- Let me know how you make out with this.
- Dim ctl As Control
-
-
For Each ctl In Me.Controls
-
If ctl.Tag = "Carry" Then
-
ctl.DefaultValue = "'" & ctl.Value & "'"
-
End If
-
Next
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia
Posts: 5,214
| | | re: how do you get data fields to carry over to a new record? Be advised that this approach does not take into consideration the carrying over of values for 'selective' Controls, see my response in Message #9.
|  | Expert | | Join Date: Jun 2007 Location: Israel
Posts: 2,584
| | | 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.
:)
|  | Expert | | Join Date: Jan 2007 Location: California
Posts: 3,835
| | | 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.
|  | Expert | | Join Date: Jun 2007 Location: Israel
Posts: 2,584
| | | 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. :)
|  | Expert | | Join Date: Jan 2007 Location: California
Posts: 3,835
| | | 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.
|  | Similar Microsoft Access / VBA bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,295 network members.
|