Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2004
    Location
    Greenville, SC
    Posts
    271

    Question Unanswered: Copy previous sheet

    We have a form that our saleman make to request a sample to be made. There are times that we may make 4 samples. Right now they have to retype the information from the last sheet. Is there a way to copy MOST of the info from the underlying (or previous) record? I say most, because I have to change the sample number, color changes, and sample sizes, etc.

    Any help would be greatly appreciated!!


    Michael
    Gotta to do some code

  2. #2
    Join Date
    Oct 2003
    Location
    London
    Posts
    341
    I've been doing a similar type of thing and I've probably not done it the easiest way but it works.

    On your first form you have field boxes called Field1 and Field2...

    On your last form you have Field3 and Field4...

    Correct?

    Create a new module "Global" and just put a couple of Global codes in..

    Option Explicit

    Global GloFieldA As String
    Global GloFieldB As String

    Thats it.

    When you leave the first form put a command to say:

    GloFieldA = my.Field1
    GloFieldB = my.Field2

    Then when you open your last form you put the code

    my.Field3 = GloFieldA
    my.Field4 = GloFieldB

    probably a lot of work when you have a number of fields but its a quick fix.

    _____Christy

  3. #3
    Join Date
    Mar 2004
    Location
    Greenville, SC
    Posts
    271
    Its not a different form. Its the same form, just a different recordset.

    Let's see if I can make sense of this! Sorry!!

    I have a company, person, sample size, number of samples, list of person doing the samples,phone, etc. let's say on Sample# ADV-102 with Red and Blue as the colors.
    When I go to the next recordset I would like to write a macro or write code so I can hit a button to copy the (company, person, sample size, number of samples, list of person doing the samples,phone, etc.) from the previous recordset. Then I can enter a new Sample number ADV-103 and add the new colors say Red and Green

    Something like that. I hope that's clearer. Sorry

    Michael
    Gotta to do some code

  4. #4
    Join Date
    Oct 2003
    Location
    London
    Posts
    341
    Ok in that case get have two command buttons one for copy and one for past.

    Under the copy button write the code

    Private sub Copy_Click()

    Glo_Field1 = My.Field1
    etc...

    End Sub

    then have a code behind the paste button

    Private Sub_Paste_Click()

    My.Field1 = Glo_Field1
    etc...

    End Sub

    *** It may be Me.Field1 I'm not sure.

    any help?

  5. #5
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004
    Quote Originally Posted by christyxo
    Ok in that case get have two command buttons one for copy and one for past.

    Under the copy button write the code

    Private sub Copy_Click()

    Glo_Field1 = My.Field1
    etc...

    End Sub

    then have a code behind the paste button

    Private Sub_Paste_Click()

    My.Field1 = Glo_Field1
    etc...

    End Sub

    *** It may be Me.Field1 I'm not sure.

    any help?
    Hi Christyxo,
    Not sure how to do this myself but just wondering. If you use that code, how will it know what record you are wanting to copy the data from? I found this online somewhere and if I can find it again I will post it here. Once needed it myself, but then the entire database changed so didn't need it. But I will look. And as said, not being a bad guy, just inquiring, as I too am still learning.

    hope you have a great day,
    Bud

  6. #6
    Join Date
    Oct 2003
    Location
    London
    Posts
    341
    No problems. I'm actually just learning myself and as I said previously it was just a quick fix.

    What it will do is copy whatever is displayed in the form at the time irrelevant of what record it is.

    In a sense it says take what ever is in the field box at this moment and make the global value equal to this.

    I'm sure there is a way to copy the entire record but I don't know how.

  7. #7
    Join Date
    Mar 2004
    Location
    Greenville, SC
    Posts
    271
    Thanks
    I really need more code than this (I think)
    I really need to know, how to cut certain items from the previous recordset and then make them enter into a new record, by pressing a button.


    Michael
    Gotta to do some code

  8. #8
    Join Date
    Mar 2004
    Location
    Greenville, SC
    Posts
    271
    Any help out there?
    Gotta to do some code

  9. #9
    Join Date
    Sep 2004
    Location
    Raleigh, NC
    Posts
    146
    I beleive the following code placed in the OnClick event of a command button will "duplicate" or copy the current record content to a new record:

    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70

    In the duplicated record, you could change the information and resave the record. Don't know if this is what you're looking for or not, but I wish you luck.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •