Results 1 to 7 of 7
  1. #1
    jermaine123 is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Posts
    10

    Combobox on main form does not requery combo box on sub form

    Hello Guys,

    I am a newbie to Ms access. I am having a problem with a modified Order Details form from Northwind 2007.

    This form has a main form (Order Details) that has a Beneficiary ID combobox. It also has a subform with the fields ITEM, QUANTITY, PRICE, DISCOUNT SUBTOTAL AND BENEFIT ID (Combobox)
    Each Beneficiary has one or more benefits that they have selected beforehand and all transaction items will be assigned to one of the selected benefits.

    When I first open the Order Details form and choose a beneficiary from the CUSTOMER ID Combobox on the main form, the correct benefits that were selected for that person are shown in the subform in the BENEFIT ID Combobox.
    If I should choose another beneficiary the correct information is also displayed. IF I SHOULD CLICK IN THE DATASHEET ON THE SUB FORM AND THEN CLICK BACK ON THE CUSTOMER ID FIELD ON THE MAIN FORM AND CHANGE THE BENEFICIARY,
    then the benefits selected in the Benefit ID combobox of the subform do not change.

    The benefits displayed in the combobox of the subform should be requeried each time a different beneficiary is chosen of the main form. I have tried the following code and various other things but with no success. I suspect that I may not be using the correct form events.

    I have attached a TEST DB.
    Username: Test Employee
    Password: Test
    VBA Password: rocky123

    Just log in and choose the New Transactions button on the home page. Please let me know what I am doing wrong.




    MAIN FORM - Customer ID afterupdate event


    Private Sub Customer_ID_AfterUpdate()

    Forms![Order Details]![sbfOrderDetails].Form![BENEFIT ID]= NULL
    Forms![Order Details]![sbfOrderDetails].Form![BENEFIT ID].Requery
    Forms![Order Details]![sbfOrderDetails].Form![BENEFIT ID]= Forms![Order Details]![sbfOrderDetails].Form![BENEFIT ID].ItemData(0)

    End Sub


    MAIN FORM - Form Current Event


    Private Sub Form_Current()

    Forms![Order Details]![sbfOrderDetails].Form![BENEFIT ID].Requery

    End Sub

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Why do you use a WhereCondition of "1=0"?

  3. #3
    jermaine123 is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Posts
    10
    Which control/macro are you refering to? I am sure that was a part of the original Northwind DB form

  4. #4
    jermaine123 is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Posts
    10
    I found the solution in another forum. All I had to do was put ....

    sbfOrderDetails.Form!Benefit_ID.Requery in the On Enter event of the Sub form control

    Thanks for your help

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Glad to hear you got it sorted. I guess you are ready to follow the link in my sig and mark this thread as Solved then, right?

  6. #6
    jermaine123 is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Posts
    10
    I marked the thread as solved. thanks man

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You are more than welcome. Just glad you came up with the solution.

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

Similar Threads

  1. Replies: 0
    Last Post: 12-16-2009, 01:14 PM
  2. Replies: 1
    Last Post: 08-14-2009, 08:41 AM
  3. Replies: 6
    Last Post: 06-03-2009, 02:01 PM
  4. Replies: 7
    Last Post: 05-24-2009, 10:24 AM
  5. Replies: 0
    Last Post: 08-17-2008, 12:19 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