Results 1 to 2 of 2
  1. #1
    bacarley is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Posts
    1

    Need help with code to enable autopopulation of form

    I'm sorry if this is overly complicated, but I know just enough to be dangerous... I am trying to format an Access pop-up form so that the vendor/customer name, number and ID autopopulate based on the information in the current input form. The form opens with these fields blank.



    My tables are:

    Vendor Data and Coverages

    The Vendor Input and Additional Insured forms are used to populate the Vendor Data table. The Coverage Input form is used to populate the Coverages table. I have a one-to-many relationship established between the Vendor Data table and the Coverages table.

    Entering information in a certain field in the Vendor Input form causes the Additional Insured form to pop up using the following code:

    Private Sub COI_AfterUpdate()

    DoCmd.OpenForm "Additional Insured", , , "[ID]=" & Me.ID

    End Sub

    When the input on this form is completed and closed, it opens the Coverage Input form using the following code:

    Private Sub Alternate_Exit(Cancel As Integer)

    DoCmd.OpenForm "Coverage Input", , , , "[ID_Vendor Data]=" & Me.ID

    End Sub

    The Coverage Input form is used to input each type of insurance coverage for each vendor and, therefore, multiple records will be input for the vendor/customer. At the end of this form, tabbing should create a new record with same vendor data, linked to that vendor.

    The relevant fields in the Additional Insured form are:

    ID (primary autonumber key in Vendor Data table) - autopopulates on form open from main Vendor Input form
    VendorNumber - autopoulates on form open
    Name - autopopulates on form open

    The fields in the Coverage Input form which I would like to autopopulate and be linked to the existing open record in the Vendor Input (and Additional Insured) form are:

    Name (from the Vendor Data table)
    VendorNumber_Vendor Data (from the Vendor Data table)
    ID_Vendor Data (from the Vendor Data table)

    The Coverages table has the following relevant fields:

    ID (primary autonumber key)
    VendorID (lookup field primary relationship link to Vendor Data "ID" field)

    Currently the Additional Insured form opens and autopopulates as desired. The Coverage Input pop-up form opens on exit from the last field in the Additional Insured pop-up, but the fields are blank (except [New] in ID_Vendor Data field) and any information input is not associated with the vendor record.

    PLEASE HELP!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Autopopulation using macros?
    By EvanRosenlieb in forum Forms
    Replies: 2
    Last Post: 06-16-2011, 01:57 PM
  2. Replies: 1
    Last Post: 02-25-2011, 10:03 AM
  3. Replies: 4
    Last Post: 02-16-2011, 11:50 AM
  4. Enable button in the master form when clicking in the detail
    By DistillingAccess in forum Programming
    Replies: 8
    Last Post: 08-03-2010, 10:54 AM
  5. could not enable autocorrect
    By easbrandel in forum Access
    Replies: 0
    Last Post: 04-15-2010, 07:10 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