Results 1 to 4 of 4
  1. #1
    dodicrossanda is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2012
    Location
    Jakarta
    Posts
    2

    Question Combobox Value in Form2 is Automatically Selected Based on Last Entry in Form1

    Dear Masters,



    I'm a newbie. I've got situation and has been simplified as mention below,

    FORM1:
    - CompanyID (TextBox)
    - Prefix (TextBox)
    - CompanyName (TextBox)
    - Suffix (TextBox)
    - Phone (TextBox)
    Button:
    - &Add New PIC (Opening New Record of form FORM2)
    - &Edit PIC (Opening Edit of form FORM2)

    FORM2:
    - PICID (TextBox)
    - CompanyName (ComboBox:
    Code:
    SELECT [CompanyID], [Prefix] & ". " & [CompanyName] & " " & [Suffix] FROM FORM1 ORDER BY [Prefix] & ". " & [CompanyName] & " " & [Suffix];
    - Division (TextBox)
    - Title (TextBox)
    Button:
    - &New (New Record)
    - &Delete (Delete Record)
    - &Close (Close form)

    Question:
    - How to configure Combobox on FORM2 automatically select its respective CompanyName(Order by Prefix. CompanyName Suffix) which just being recorded from FORM1 after clicking Add New PIC's Button on FORM1 ?

    Thank you for your ideas and suggestions.

    Best regards,

    Dodi

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Is this a form/subform arrangement? What is purpose of these forms? Why do you need the company name selected in form 2?

    Want to provide db for analysis? Follow instructions at bottom of my post.
    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.

  3. #3
    dodicrossanda is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2012
    Location
    Jakarta
    Posts
    2

    Post

    Quote Originally Posted by June7 View Post
    Is this a form/subform arrangement? What is purpose of these forms? Why do you need the company name selected in form 2?

    Want to provide db for analysis? Follow instructions at bottom of my post.
    Hello June7,

    This is a form arrangement. I am sorry that I forgot to mention about field "PICName" on FORM2. FORM1 is company database and FORM2 is PIC(Person In-Charge) database. The purpose of these forms are:
    - record company database
    - record PIC (Person In-charge) in each of recorded companies where each of them probably may have more than 1 PIC.
    So, once I've finished making a new entry in company database then I wanna go straight to make new record for PIC by clicking its button on FORM1. Currently, once FORM2 is opened and I start to make new record for PIC...it shows only fresh blank form with combobox not automatically selected. What I mean here is, I wanna make new entry without selecting/ scrolling down the dropdown list of combobox. I also have attached the file. I hope this would help to explain what I meant. Thank you June7 for your response.

    Best regards,

    Dodi
    SampleComboBox.zip

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    The easiest solution is form/subform arrangement. The PIC form would be a subform on the company form. The Master/Child links properties of subform container will synchronize related records. The company primary key will automatically save to the PIC record. No code needed. However, for this to work, you need to save the companyID into PIC table, not company name because the ID is set as the PK. Even if you don't use form/subform and the forms remain independent, the PK should be saved.
    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. Replies: 7
    Last Post: 06-14-2011, 10:37 AM
  2. Replies: 6
    Last Post: 05-05-2011, 08:50 AM
  3. Replies: 4
    Last Post: 04-18-2011, 07:18 AM
  4. Replies: 0
    Last Post: 08-24-2010, 06:38 PM
  5. Replies: 1
    Last Post: 12-01-2009, 09:00 AM

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