09-12-14, 11:16 #1Registered User
- Join Date
- Sep 2014
Unanswered: Combo box value requirement for query row source
I am working in MS Access 2007 and have a form with combo boxes whose row sources are pulled from a query. How do I make sure that these values are required?
For example, I have other combo boxes whose row sources are from a table, and with those table values having a required property, a message appears every time I click my command button to insert a new record stating that the command box value must be entered. I want to replicate this result for the command boxes whose row sources are from a query, but do not know how to do so.
I have tried several different methods:
*Creating a validation rule in the property sheet, but I need to make sure that the the combo boxe's value cannot be null or cannot be an empty string aka "".
*Using VBA to set the Validation Property, but I am still able to add the record and don't get a warning message.
*Using VBA to create a MsgBox if the combo box is null when the command button is clicked, but this doesn't seem to be successful.
Below is a link of some VBA code I have written. One such example of a combo box that I am trying to have this occur is 'ContactPosition':jimmyim23's uploaded images - Imgur
Thank you and have a great weekend!
09-15-14, 02:54 #2Jaded Developer
Provided Answers: 59
- Join Date
- Nov 2004
- out on a limb
post images or db as attachments to the thread please.
if a value is required set the required property for each appropriate columnn in the table definition
that way round you should not have to do any code (granted you can if you so wish, but the SQL engine will not allow an insert of a row which doesn't meet its definition
Access/JET ahas a quirk by which the form only takes not of validation rules and similar that were in force prior tot he forms design. after a form is initially designed it may not recognise validation rules, but it will alwasy enforce a 'required' propertyI'd rather be riding on the Tiger 800 or the Norton