Make text box automatic, based on drop-down menu

Anonymous
2011-03-21T18:06:56+00:00

I am using Microsft Access 2007.  I have a form that has a drop-down menu to select a customer from a separate table.  I have a text box next to it for the part number, and another text box next to that for the program number.  The P/Ns are specific to each customer.  So, I would like to make it such that, in this form, when a customer is selected from the menu, the P/Ns automatically generate.  How can this be done?

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

45 answers

Sort by: Most helpful
  1. Anonymous
    2011-03-30T16:06:24+00:00

    You can set a breakpoint by clicking in the left margin on a line of code.  The line of code should then be highlighted in red and a big red dot will be displayed in the margin.  When the code is executed, it should stop on the breakpoint line, which should then be highlighted in yellow.  Use the Debug - Continue menu item to let the code proceed.

    WARNING:  Do not edit the code module in any way while the form/report is in any view except design view.  Always switch the form/report to design view before touching the keyboard.

    To add a MsgBox line, just enter another line of code at a strategic place in the procedure.  E.g:  MsgBox "AfterUpdate executing".  Then message should pop up when the procedure executes.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2011-03-30T15:18:47+00:00

    To the contrary, I'm fairly certain the AfterUpdate even procedure is not being executed.  The AfterUpdate property does contain [Event Procedure]. 

    What do I need to do to create a breakpoint or MsgBox?

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2011-03-30T14:02:04+00:00

    Are you sure the the AfterUpdate event procedure is being executed?  First, check that the combo box's AfterUpdate property contains:

       [Event Procedure]

    If it does, then add a breakpoint or MsgBox to the event procedure so you are notified when the code runs.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2011-03-30T10:56:02+00:00

    I've already done all of that.  I simply cannot get the Events to make anything happen, using the code that you suggested.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2011-03-29T20:05:24+00:00

    The combo box's RowSource needs to have a query something like:

    SELECT customer, [Final Part Number], [Assembly Part Number]

    FROM customerstable

    ORDER BY customer

    And the combo box's properties:

    BoundColumn    1

    ColumnCount     3

    ColumnWidths   ;0;0

    Make sure the text boxes have their ControlSource set to the name of the corresponding part number field in the form's RecordSource table.

    Get this to work before going off on tangents about whether you need the text boxes or not.

    Was this answer helpful?

    0 comments No comments