0

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?

Erik A
  • 31,639
  • 12
  • 42
  • 67
rodedo
  • 791
  • 4
  • 10
  • 23
  • To add on, I changed my vba code to:
    Private Sub Stanza_NotInList(NewData As String, Response As Integer) MsgBox ("Hallo Word!") End Sub
    But I do not see the message box, so I miss some basic point to ensure that my "not-in-list" code is executed...
    I keep on googleing around, but help would be appreciated.
    – rodedo Sep 02 '12 at 08:56

1 Answers1

1

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.

rodedo
  • 791
  • 4
  • 10
  • 23
  • To quote my answer to your previous question ( http://stackoverflow.com/questions/12131211/create-form-to-add-records-in-multiple-tables ) "To add records to the authors table, you need to set Limit To List to Yes" – Fionnuala Sep 02 '12 at 18:42
  • Yep. As said, I missed that part even if I read it in at least three different places including your answer. My eyes saw it "yes" but my brain kept on telling me "no"... – rodedo Sep 03 '12 at 10:08