Search code examples
ms-accessvbams-access-2003

NotInList script


I am trying to use Access and VBA to create a DB to store my library. I already posted a question and got a useful answer but I am still failing with the basics, so, after having checked this tutorial link I am starting from scratch and doing it in smaller steps (i.e. asking more basic questions...). I have the following DB structure and relationship details:
DB structure and relationship details http://img195.imageshack.us/img195/8184/relationshipdetails.png
Using the Access AutoForm:Columnar wizard I created a Form based on the Table Libri, then I changed the field "Stanza" into a ComboBox, I entered the RowSource as follows:
ComboBox http://img560.imageshack.us/img560/160/comboboxdata.png
Then in the Event tab I selected the ... controls in the NotInList and in the VBA I entered the following code:
VBA code http://img689.imageshack.us/img689/1416/notinlistcode.png
Saved everithing, but when I open the Form Libri and try to enter a value in the ComboBox I get the following error message:
Error message http://img41.imageshack.us/img41/8937/errormsgt.png
All my tables are empty (no records). So the VBA code seems not to be considered/executed at all, what am I doing wrong or missing?


Solution

  • Ok, I was completely blind. The error is the option: "Limit to list" that I set to "NO" and instead, the NotInList event is only filred if such option is set to "yes". I find this conter-intuitive, but at least now I know. Sorry for bothering other. hope this is helpful some other newbe like me.