Results 1 to 3 of 3
  1. #1
    ganoudij is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    2

    Appending Data to Current Record on a Form

    I created a form (F_Contractor Select1A) that adds a combo box to a customized parameter value popup box which allows you to select a contractor from a list (T_ContractorList). Once you select a contractor from the combo box list it runs a query (Q_Contractor#1A) that appends data to the current open form. However, it only appends it to a new record and I need it to append it to the current record open on the form (F_CurLoans). Code closes and reopens the current form once the data has been appended to the table (T_CurLoans) so that it displays on the form. How can I get it to append the current record?

    Here's the query in SQL:
    INSERT INTO T_CurLoans ( [Contractor Name#1], [Contractor#1Vendor#], [Contractor#1Fax#], [Contractor#1Cell#], [Contractor#1Phone#], [Contractor#1E-mail], [Contractor#1E-mail#2] )
    SELECT [T_Contractor List].ContractorName, [T_Contractor List].[Vendor#], [T_Contractor List].[Fax#], [T_Contractor List].[Cell#], [T_Contractor List].[Phone#], [T_Contractor List].[E-mail], [T_Contractor List].[E-mail#2]
    FROM [T_Contractor List]


    WHERE ((([T_Contractor List].ContractorName)=[Forms]![F_Contractor Select1A]![Contrtactor List]));


    Here's the code:

    Private Sub Contrtactor_List_AfterUpdate()
    DoCmd.OpenQuery "Q_Contractor#1A", acViewNormal, acEdit
    DoCmd.Close acForm, "F_Contractor Select1A"
    DoCmd.Close acForm, "F_CurLoans"
    DoCmd.OpenForm "F_CurLoans"
    End Sub

    TIA, Julian

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Data doesn't get appended to the current record.

    A new record is appended to a Table.

    Data may be used to update existing values in a record.

    You may wish to review:
    Append queries (Insert INTO......) see http://www.techonthenet.com/sql/insert.php

    Update queries (Update tableXXX Set fld1 = "New Value for fld1"....
    see http://www.techonthenet.com/sql/update.php

    As an aside, you should not be using special characters (spaces, #..) in field and object names. see http://allenbrowne.com/AppIssueBadWord.html

  3. #3
    ganoudij is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    2
    Thanks! I think I see a way around this. My form (F_Curloans) has a second append query which starts a new record and populates customer data from a pending form (it is run first). I think I will add a second combo box to my popup and append everything at once...that sounds better anyway! I had hoped there was a way to designate active, or current record for the append query but guess not, thanks for straightening me out on that. Special characters, yes, sloppy on my part, had planned to change that. Thanks for your help!!

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

Similar Threads

  1. Replies: 63
    Last Post: 01-25-2013, 05:20 AM
  2. Run Update Query on Current Record in Form
    By c3pse in forum Queries
    Replies: 3
    Last Post: 08-14-2010, 05:40 AM
  3. Query based on current record in form
    By bhsvendbo in forum Queries
    Replies: 1
    Last Post: 06-01-2010, 11:20 AM
  4. Replies: 3
    Last Post: 02-28-2010, 11:05 PM
  5. Open form to current record
    By rbpd5015 in forum Access
    Replies: 1
    Last Post: 08-28-2009, 01:53 AM

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