?
Solved

Carry over values from last record to new one

Posted on 2003-03-29
9
Medium Priority
?
518 Views
Last Modified: 2008-02-01
I need some help in carrying over the text from different fields into a new record when in is created.
0
Comment
Question by:hfijalko
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 12

Accepted Solution

by:
nexusnation earned 200 total points
ID: 8231995
DoCmd.RunCommand acCmdSelect
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdPasteAppend

or:

Dim name As String
Dim address As String
'etc...
name = Me.Name
address = Me.Address
'etc...
DoCmd.GoToRecord,,acNewRec
Me.Name = name
Me.Address = address
'etc...

need help understanding the above?

Andrew
0
 
LVL 4

Expert Comment

by:dotthei
ID: 8232042
you can also type CTRL+' in some situtations (also known as the "ditto key")
0
 
LVL 12

Expert Comment

by:nexusnation
ID: 8232049
uh huh.  i use it :-)

the second idea (setting variables to the values, creating a new record, and then setting the values to the variables) is the CTRL+' but working for multiple fields at a time. plus, my second idea enables for some but not all of the fields to be duplicated.

nex
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 4

Expert Comment

by:dotthei
ID: 8232079
I made my earlier post and then switched back to a customer app that I am almost finished with -
there, I rewrote a Copy Shipping Address procedure using your code snip as a guide.

I don't pay commissions or royalties, though :-)
0
 

Author Comment

by:hfijalko
ID: 8232152
After I posted the question I found a solution elsewhere.  I will give you credit for the answer even though I did not try it out.
0
 
LVL 12

Expert Comment

by:nexusnation
ID: 8232163
i want royalty! i want royalty! grrr...

a request for a grade change will be made. it does not cost more points to assign a better grade, and my answer was perfectly accurate. no hard feelings, hfijakco.

nex
0
 
LVL 12

Expert Comment

by:nexusnation
ID: 8232171
also, i answered it before you said that you found another solution.

one one last note, what was your solution?
0
 

Author Comment

by:hfijalko
ID: 8238549
If you want a grade change I would be happy to accommodate you but I am unsure on how to do this.  I looked through the page to see where to do this but could find none.


Here is the solution that I found



Private Sub Form_AfterUpdate()
On Error GoTo Err_Form_AfterUpdate

    Dim ctl As Control
    For Each ctl In Screen.ActiveForm.Controls
        If ctl.Tag = "Move" Then
            ctl.DefaultValue = """" & ctl.Value & """"
        End If
    Next
   
Exit_Form_AfterUpdate:
    Exit Sub

Err_Form_AfterUpdate:
    MsgBox Err.Description
    Resume Exit_Form_AfterUpdate
End Sub


I then placed "Move"  in the Tag line of each field that you want carryed over.


0
 

Expert Comment

by:SpideyMod
ID: 8239197
Grade changed from C to A.  Thanks  hfijalko for posting your solution.  It has added great value to this PAQ.

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question