Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Carry over values from last record to new one

Posted on 2003-03-29
9
Medium Priority
?
524 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
  • 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

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.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Suggested Courses

571 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