Results 1 to 2 of 2
  1. #1
    LadyScot101 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    18

    Form Field Duplication

    I have a form that I enter data in. I click on a button from the menu to open the form. I copied the button and then changed the name of the new for. Here is the code that I have that I copied:



    Private Sub Direct_Pay_Claim_Click()
    On Error GoTo Err_Direct_Pay_Claim_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocNam = "PO Information"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    Exit_Direct_Pay_Claim_Click:
    Exit Sub

    Err_Direct_Pay_Claim_Click:
    MsgBox Err.Description
    Resume Exit_Direct_Pay_Claim_Click

    End Sub

    The copied code is the same, except I changed Direct_Pay_Claim to Energy_Cap

    I deleted the fields that I didn't want and saved it. I open the Direct Pay Claim and the form has changed to what I changed in Energy Cap. Why??? I'm thinking it has to do with the stLinkCriteria, but not sure. They use the same table information, but why would the forms be the same if the code names were change?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I'm not sure I follow, but you realize this is what determines which form is opened?

    stDocNam = "PO Information"

    Also note:

    stDocNam = "PO Information"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    which can be avoided using:

    http://www.baldyweb.com/OptionExplicit.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Automatic duplication of form when pressing ENTER
    By tanveerksingh in forum Forms
    Replies: 7
    Last Post: 08-15-2012, 10:03 AM
  2. Prevent Duplication in Sub Form
    By Jamaluddin in forum Forms
    Replies: 4
    Last Post: 12-22-2011, 03:31 PM
  3. Query Duplication
    By Lois in forum Queries
    Replies: 1
    Last Post: 11-22-2011, 08:47 AM
  4. Duplication in a report
    By newtoAccess in forum Reports
    Replies: 9
    Last Post: 03-05-2011, 05:41 AM
  5. duplication
    By noidea in forum Access
    Replies: 1
    Last Post: 07-31-2009, 06:22 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums