Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    May 2001
    Location
    Oxfordshire
    Posts
    456
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Copy data from one table to new record (2003 SP2)

    I'm sure this is pretty simple, but I'm stymied. In the attached DB, SfrmHomo, the user clicks on a button at the right of the screen to finish/close a record. What I've been asked for is that the data in the following fields be copied into a new record, in FrmCoolerEntry. The record will then have the other relevant fields filled by the user.

    I thought about building an append query into the button, but am not sure how to specify the current/selected record.
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Copy data from one table to new record (2003 SP2)

    You mention "data in the following fields". What exactly do you mean by that?

  3. #3
    4 Star Lounger
    Join Date
    May 2001
    Location
    Oxfordshire
    Posts
    456
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy data from one table to new record (2003 SP2)

    I was getting ahead of myself & forgot to specify which those fields were. Anyway the ones asked for are;
    [CastNo], [NoOfLogs], [CastNo2] & [NoOfLogs].

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Copy data from one table to new record (2003 SP2)

    I assume that the last one should have been NoOfLogs2.

    Add this line to the On Click event procedure of Command32 on SFrmHomo:

    DoCmd.OpenForm FormName:="frmCoolerEntry", DataMode:=acFormAdd, OpenArgs:="FromSFrmHomo"

    Add an On Load event procedure to frmCoolerEntry:

    Private Sub Form_Load()
    If Me.OpenArgs = "FromSFrmHomo" Then
    Me!CastNo = Forms!frmMainEdit!SFrmHomo!CastNo
    Me!NoOfLogs = Forms!frmMainEdit!SFrmHomo!NoOfLogs
    Me!txtCastNo2 = Forms!frmMainEdit!SFrmHomo!CastNo2
    Me!TxtLogs2 = Forms!frmMainEdit!SFrmHomo!NoOfLogs2
    End If
    End Sub

    This code tests whether the form has been opened from the Command32 button (by looking at OpenArgs), and if so, copies the values from SFrmHomo.

  5. #5
    4 Star Lounger
    Join Date
    May 2001
    Location
    Oxfordshire
    Posts
    456
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy data from one table to new record (2003 SP2)

    Cheers mate.

Posting Permissions

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