Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2011
    Posts
    413

    Unanswered: Popup Form, then save record

    I have a popup form to take notes with that opens from a main form. After I enter my notes I want the main form to save the record by itself. Here is my code but it does not save the record on the main form.

    Private Sub Form_Close()
    On Error GoTo Err_Command200_Click
    Forms![frm_main]![NextLetter] = Forms![frm_cupidnotes]![TxtDescription]
    TxtDescription.SelStart = Len(lettermemo)
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    Forms![frm_main]![NextLetter].SetFocus
    DoCmd****nCommand acCmdSaveRecord
    Forms!frm_cupidnotes.Dirty = False
    DoCmd****nCommand acCmdSaveRecord
    DoCmd.Close


    Exit_Command200_Click:

    Err_Command200_Click:
    Exit Sub
    End Sub

  2. #2
    Join Date
    Oct 2006
    Posts
    110
    If you have a memo field for notes in a sub form, you probably don't need to have the sub form set to a record source.

    Try the below, this is basically what I used to move the data from the sub form to the main form, then save the data to the main form.

    Private Sub Form_Close()
    Forms![frm_main]![NextLetter] = Forms![frm_cupidnotes]![TxtDescription]
    Forms![frm_main]![TxtDescription].SetFocus 'Move focus back to main form
    Forms![frm_main].Dirty = False 'Save record in main form
    end sub

    This should get you what you need or at least a good start
    Last edited by cmays637; 09-10-12 at 23:07.

  3. #3
    Join Date
    Nov 2011
    Posts
    413
    It is an unbound popup form, not a sub-form. I still get the same result. Thanks,

  4. #4
    Join Date
    Oct 2006
    Posts
    110
    Try the below. I've modified it, my field names were off. It should take what is in your pop up form and move it to your frm_main next letter field, then save the frm_main record to the table.

    Add it to the on close event of your frm_cupidnotes form.

    Forms![frm_main]![NextLetter] = Forms![frm_cupidnotes]![TxtDescription]
    Forms![frm_main]![NextLetter].SetFocus 'Move focus back to main form
    Forms![frm_main].Dirty = False 'Save record in main form

Posting Permissions

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