This group is fine for clarifying your understanding.
The line you are asking about declares the procedure that handles the
NotInList event for a combo box named "cboCategoryName". Inside the brackets
are 2 things that Access provides to the procedure whenever it runs.
The first is named "NewData", and it is a string variable. It is the value
that has been typed into the box which was not found in the RowSource of the
combo. If you wish, you can write code that adds the NewData to the table
that supplies the list of values for the combo - the table named in its
RowSource property. That solves the problem: the data is now in the list.
For an example of how to do that, see:
NotInList: Adding values to lookup tables
at:
http://allenbrowne.com/ser-27.html
The 2nd argument Access provides is named "Response", and it is an Integer
variable. You can set the value of Response to tell Access what it should do
from here. If you do add the NewData to the lookup table, set Response to 2.
Access reads the number, reloads the combo, and is then happy the value *is*
now in the list. Instead of having to remember that 2 is the magic number,
use the constant "acDataErrAdded", i.e.:
Response = acDataErrAdded
Some other event procedures have an argument named Cancel. If so, you can
cancel the event by setting this to True. For example, if you put this code
into the Open event procedure of a form, it would never open. Every time you
tried to open it, the Form_Open event would be cancelled, and so Access
would never open the form:
Private Sub Form_Open(Cancel As Integer)
Cancel = True
End Sub
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Donna Sabol" <dsabol2000@yahoo.com> wrote in message
news:e81dd1de.0401210626.25c16c82@posting.google.c om...[color=blue]
> I know a little about VBA, but everything I know I've learned on my
> own through trial and error (and cut & paste). Now I'm actually
> taking a class, but it's online twice a week.
>
> I'm running through the chapters on my own and I'm coming up with some
> questions that I'm afraid might be too stupid to post here (don't want
> to ruin my image, hahaha)
>
> Does anyone know where I might go to find answers to such simple
> questions, via posting or researching, when my classes are not in
> session?
>
> Ok, the question I have right now is in this statement:
> Private Sub cboCategoryName_NotInList(NewData As String, Response As
> Integer)
>
> Is "NewData" a set "function" (right term?) that Access recognizes?
> Because I notice I'm not declaring anywhere what NewData will be when
> this code runs... Same with "Response".
>
> And later in the code I set Response = acDataErrContinue, so I'm
> assuming that acDataErrContinue must be one of those functions that is
> either 0 or 1? Like True or False?
>
> Just in case, here's the whole procedure:
>
> Private Sub cboCategoryName_NotInList(NewData As String, Response As
> Integer)
>
> MsgBox "The value that you entered, " & NewData & ", is not in the
> list."
>
> Response = acDataErrContinue
>
> End Sub
>
>
> Thanks![/color]