DeveloperBarn Forums

DeveloperBarn

Programming & IT forum

VBA Code on an On Click Event Procedure

This is a discussion on VBA Code on an On Click Event Procedure within the Microsoft Access forums, part of the Databases category; I have created 2 cascading combo boxes on a form, Client and Magazine. When the user selects the Client, the ...

Go Back   DeveloperBarn Forums > Databases > Microsoft Access

  #1  
Old December 11th, 2008, 11:48 AM
Barn Newbie
 
Join Date: Oct 2008
Posts: 2
Rep Power: 2
CushingMT is an unknown quantity at this point
Default 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!
Reply With Quote
  #2  
Old December 11th, 2008, 12:50 PM
Rebelle's Avatar
Barn Loyal
 
Join Date: Mar 2008
Posts: 748
Rep Power: 2
Rebelle will become famous soon enough
Default

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.
Reply With Quote
  #3  
Old December 11th, 2008, 01:01 PM
sbenj69's Avatar
Moderator
 
Join Date: Mar 2008
Location: The frigid northern plains
Posts: 260
Rep Power: 4
sbenj69 is a jewel in the roughsbenj69 is a jewel in the roughsbenj69 is a jewel in the rough
Default

Actually, check out this thread: Cascading Combo Boxes

It contains 2 samples that I created.

Hope it helps

Comments on this post
Rebelle agrees: Thanked Post
jmurrayhead agrees: Thanked Post
boblarson agrees: Thanked Post
__________________
Join our Folding team: DeveloperBarn Folding
-----------------------------------
Folding Stats - Stanford University
Folding Stats - Extreme Over-Clocking
Folding Stats - Kakao Stats
Folding Stats - Xtreme CPU

-----------------------------------
Reply With Quote
The Following 3 Users Say Thank You to sbenj69 For This Useful Post:
boblarson (December 18th, 2008), jmurrayhead (December 18th, 2008), Rebelle (December 11th, 2008)
  #4  
Old December 11th, 2008, 01:03 PM
Rebelle's Avatar
Barn Loyal
 
Join Date: Mar 2008
Posts: 748
Rep Power: 2
Rebelle will become famous soon enough
Default

follow sbenj69s advice.. ...
Reply With Quote
  #5  
Old December 16th, 2008, 05:18 PM
sbenj69's Avatar
Moderator
 
Join Date: Mar 2008
Location: The frigid northern plains
Posts: 260
Rep Power: 4
sbenj69 is a jewel in the roughsbenj69 is a jewel in the roughsbenj69 is a jewel in the rough
Default

Did this help at all?
Reply With Quote
  #6  
Old December 18th, 2008, 08:05 AM
Barn Newbie
 
Join Date: Oct 2008
Posts: 2
Rep Power: 2
CushingMT is an unknown quantity at this point
Default Thanks!

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

  DeveloperBarn Forums > Databases > Microsoft Access

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

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


All times are GMT -4. The time now is 02:41 AM.


Copyright ©2008-2010, DeveloperBarn

Content Relevant URLs by vBSEO 3.3.2