Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2003
    Location
    New York
    Posts
    47

    Unanswered: accessing a new record on a subform to enter data from another subform

    I have a main contact page with a bunch of subforms on different tabs. When they send an email, fax or letter from one subform, I need it to note the fact that it was sent on another subform. And this is working. The problem is that it keeps over writing the record that is there instead of creating a new record. When I try to send it there with various ideas from my limited knowledge of code, it keeps coming back either wrong arguments or Object doesn't support this property or method. Below is my code with the latest try on the first line.

    Help would be greatly appreciated.

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "rptBlankFaxMatter"
    stLinkCriteria = "[ContactID]=" & Me![intContact] & " And [MatterID]=" & Me![intMatter]


    [Forms]![frmMatter]![sfrmActivity-Matter].[intContact].SetFocus
    DoCmd.GoToRecord , , acNewRec
    [Forms]![frmMatter]![sfrmActivity-Matter].[Form]![intContact] = Forms![frmMatter]![sfrmActivity-Matter]![intContact]
    [Forms]![frmMatter]![sfrmActivity-Matter].[Form]![datActivity] = Date
    [Forms]![frmMatter]![sfrmActivity-Matter].[Form]![intMatter] = [intMatter]
    [Forms]![frmMatter]![sfrmActivity-Matter].[Form]![txtType] = "Fax"
    DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
    DoCmd.OutputTo acOutputReport, stDocName, acFormatRTF, Forms![frmMatter]![sfrmMatterContacts-Matter].Form![txtLName] & ", " & Forms![frmMatter]![sfrmMatterContacts-Matter].Form![txtFName] & " " & Format(Date, "m-d-yyyy") & ".doc", True
    DoCmd.Close acReport, stDocName

    Terri
    Terri Gavin

  2. #2
    Join Date
    May 2010
    Posts
    601
    If it were me, I would run an append query to add the record followed by a requery of the sub form. This will avoid any focus or timing issues. I find this would the best and is a lost more reliable.

    If you must simulate data entry on the form, try add the comment tot he sub for as teh last step.
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

Posting Permissions

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