Results 1 to 4 of 4
  1. #1
    Nad_user is offline Novice
    Windows XP Access 2003
    Join Date
    Apr 2010
    Posts
    2

    After_Update Procedure

    hi,



    I have a combo box called Course in a form called Employee (using table Employee) this combo box gets information from another table called Course. and I have another field in the form employee called Course_id.

    what i need is: when i select any value from the combo box course (Say Math which has ID= 1), i want the field course_id to be filled with the id of the course.

    I created an after_update event on the field Course but i cannot seem to find the right code to write in it that does the work.

  2. #2
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    let me describe a hypo situation:

    I have a table course with columns: {ID(PK),CourseID,Subject}
    and in employee table I have two Fields CourseID, Subjects
    Now I want when I select subject the code is automatically populated.
    Go to the Combobox in the employee table that you use to select Subject. in the underlying Query Select all the fields ID,CourseID,Subjects
    Now make sure the the Column Count is Three.
    in this case the column Index will be in this order:
    ID=0
    CourseID=1
    Subject=2

    This will obviously depend upon the order of your fields.
    Suppose you Select only Subjects as the First Column of the Query and CourseID as the Second Column then the Index will be 0 , 1.

    Now in the afterUpdate of the ComboBox put the following Code:
    Me.CourseID=Me.Subjects.Column(ColumnNumber)

    Here is a practical e.g.
    Me.DepartmentName = Me.Department_ID.Column(2)

    When the user Selects Department_ID, DepartmentName is populated with the value pertaining to that Department_Name from Column 2 of the combobox Department_ID. Here Column 2 is Department Name.

    if this solves your problem mark the thread solved.

  3. #3
    Nad_user is offline Novice
    Windows XP Access 2003
    Join Date
    Apr 2010
    Posts
    2
    Thanks a lot! it work perfectly

  4. #4
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    No probs welcome to the Forum!!!!!

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

Similar Threads

  1. Events Procedure Question..
    By Procom Webserve in forum Access
    Replies: 16
    Last Post: 12-07-2009, 10:13 AM
  2. On Click Event Procedure
    By MrDean in forum Forms
    Replies: 3
    Last Post: 10-07-2009, 07:16 AM
  3. How to run VBA procedure
    By bkelly in forum Programming
    Replies: 8
    Last Post: 09-26-2009, 06:08 PM
  4. how to call a sub procedure?
    By dollygg in forum Access
    Replies: 1
    Last Post: 08-18-2009, 05:10 AM
  5. Troubleshoot NotInList Event Procedure
    By skyrise in forum Programming
    Replies: 4
    Last Post: 02-23-2009, 06:06 PM

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