Results 1 to 4 of 4
  1. #1
    sliminconcoova is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2010
    Location
    Wiltshire
    Posts
    16

    Pre populate a second form

    Hi guys, sorry if this question has been asked before but I can not find an answer I can understand so please bare with me as I am quite the rookie at things like this.

    I have form one (Customers) and it has a subform Servers which I dont want the user to edit directly. So to get round this I want a button to open the (Servers) form in add mode. I know how to do that, what I want though is the Customer drop down list to be populated with the customer being viewed in the first form.

    My research revealed I need to possibly carry over the information, I have no idea how to do this? Hope you can help.

  2. #2
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010
    Location
    Madison
    Posts
    682
    To move to the appropriate 'Customer' on the Main form when a combobox value is selected on the subform...

    You could make sure the CustomerID or whatever field uniquely identifies the customer in the main table is a column in the dropdown box on the subform (I'm assuming this combobox is on the subform), and then in the afterupdate event, you could put code in as such:

    Assuming you have a 'CustomerID' field in the main table
    dim CustID as variant
    CustID = me.MySubformComboboxField.column(X)
    'where X is the appropriate column that has the CustomerID value
    Forms!MyMainCustomerForm.setfocus
    Forms!MyMainCustomerForm!CustomerID.setfocus
    'assuming that the CustomerID field on the main form is enabled and visible.
    docmd.findrecord CustID
    'Now requery the subform...
    Forms!MyMainCustomerForm!MyServerSubformName.reque ry

  3. #3
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010
    Location
    Madison
    Posts
    682
    I think I misunderstood your question. After re-reading my response, I don't think I answered your question. Could you explain a little more?

  4. #4
    sliminconcoova is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2010
    Location
    Wiltshire
    Posts
    16
    no that does answer my question thanks pk! it puts me in the right direction at least. Its the coding bit i struggle with and that helps a lot! two smileys for you lol

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

Similar Threads

  1. Use Combo Box to Populate Form
    By gracysaurus in forum Forms
    Replies: 1
    Last Post: 08-09-2010, 02:40 PM
  2. Auto-populate form question: again!
    By revnice in forum Access
    Replies: 5
    Last Post: 08-06-2010, 04:02 PM
  3. Auto-populate form question
    By revnice in forum Access
    Replies: 19
    Last Post: 08-06-2010, 01:01 PM
  4. Populate or Empty Form
    By gazzieh in forum Forms
    Replies: 0
    Last Post: 12-02-2009, 05:56 AM
  5. Replies: 1
    Last Post: 08-14-2009, 08:41 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