+ Reply to Thread
Results 1 to 6 of 6

Thread: VBA Code on an On Click Event Procedure

  1. #1
    Barn Newbie CushingMT is an unknown quantity at this point CushingMT's Avatar
    Join Date
    Oct 2008
    Posts
    2
    Rep Power
    4

    VBA Code on an On Click Event Procedure

    I have created 2 cascading combo boxes on a form, Client and Magazine. When the user selects the Client, the drop down for the Magazine automatically populates with the magazines specific to the client. This is working perfectly. However, if the user goes back and changes the Client, but not the Magazine, the record will save with the incorrect combination.

    I also have a Submit button, that I coded to save the record and open a new one. I want to add code that will return an error message to the user, if the magazine is not one that the client supports. I have 1 table (tblclients) that lists all of the clients, but I have multiple tables broken down for the magazines for each client.

    How do I write code that will verify that the magazine is one of the clients? I have already set the Limit to List field to Yes, but that will not work when the client is changed, and the magazine is not.

    Any and all assistance would be greatly appreciated!

  2. #2
    Barn Legend Rebelle will become famous soon enough Rebelle's Avatar
    Join Date
    Mar 2008
    Posts
    1,522
    Rep Power
    5

    Hi CushingMT,
    I think you need to requery to so if/when its changed the second list gets updated....I think this is what you are looking for.

    here is an example:

    Example

    Not sure about the error handling.

  3. #3
    Barn Enthusiast sbenj69 is a jewel in the rough sbenj69 is a jewel in the rough sbenj69 is a jewel in the rough sbenj69 is a jewel in the rough sbenj69's Avatar
    Join Date
    Mar 2008
    Location
    The frigid northern plains
    Posts
    432
    Rep Power
    7

    Actually, check out this thread: Cascading Combo Boxes

    It contains 2 samples that I created.

    Hope it helps
    Join our Folding team: DeveloperBarn Folding
    -----------------------------------
    Folding Stats - Stanford University
    Folding Stats - Extreme Over-Clocking
    Folding Stats - Kakao Stats
    Folding Stats - Xtreme CPU

    -----------------------------------

  4. #4
    Barn Legend Rebelle will become famous soon enough Rebelle's Avatar
    Join Date
    Mar 2008
    Posts
    1,522
    Rep Power
    5

    follow sbenj69s advice.. ...

  5. #5
    Barn Enthusiast sbenj69 is a jewel in the rough sbenj69 is a jewel in the rough sbenj69 is a jewel in the rough sbenj69 is a jewel in the rough sbenj69's Avatar
    Join Date
    Mar 2008
    Location
    The frigid northern plains
    Posts
    432
    Rep Power
    7

    Did this help at all?
    Join our Folding team: DeveloperBarn Folding
    -----------------------------------
    Folding Stats - Stanford University
    Folding Stats - Extreme Over-Clocking
    Folding Stats - Kakao Stats
    Folding Stats - Xtreme CPU

    -----------------------------------

  6. #6
    Barn Newbie CushingMT is an unknown quantity at this point CushingMT's Avatar
    Join Date
    Oct 2008
    Posts
    2
    Rep Power
    4

    Thanks!

    Yes, this worked perfectly. Thank you so much for your assistance.

+ Reply to Thread

Similar Threads

  1. Need PHP/SQL code help...to fix written code
    By honeybeeaz in forum PHP Development
    Replies: 10
    Last Post: November 11th, 2008, 03:22 PM
  2. On onchange event hide blank frame
    By guddu in forum JavaScript Programming
    Replies: 3
    Last Post: September 8th, 2008, 10:14 AM
  3. Grouping buttons to one event
    By Shem in forum .NET Development
    Replies: 8
    Last Post: July 17th, 2008, 07:53 AM
  4. adding an event for my btnDelete in repeater
    By Shem in forum .NET Development
    Replies: 13
    Last Post: July 15th, 2008, 10:33 AM
  5. addLoadListener - adding onload event in generic way
    By Shadow Wizard in forum JavaScript Code Samples
    Replies: 0
    Last Post: July 13th, 2008, 02:20 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO