Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NotInList error 1

Status
Not open for further replies.

rproactive

Technical User
Oct 6, 2005
65
0
0
US
HI I am using a module (ref GLOBAL Not In List Event Handler faq702-5205) to allow entering new values in combo box. It is generating the following error: “Compile error: Expected variable or prodedure, not module”

The event code I attached to the combo box is:
Code:
Private Sub cboBanksID_NotInList(NewData As String, Response As Integer)    
    If AddToList(Me, "L_Bank", "BankName") Then
        Response = acDataErrAdded
    Else
     Response = acDataErrContinue
       Me!cboBanksID.Undo 'Optional. Restores previous text.
    End If

The error is at statement: If AddToList (Me, "L_Bank", "BankName") Then

This FAQ is exactly what I have been looking for & would love to get it to work.
Any ideas onwhat’s wrong?
TheAceMan1 is author of the FAQ- thanks for coming up with a very use- again any help it me getting to work is appreciated.
 
Hmm... Did you perhaps name your module with the same name as the procedure (i.e. AddToList)?

Ken S.
 
No I don't think so

Module: AddToList
Procedure: is code behind On Not in List
Private Sub cboBanksID_NotInList(NewData As String,
Response As Integer)

Thanks for the suggestion though. Any other thoughts??
 
???

Your "not in list" code calls a procedure: "AddToList"
If AddToList(Me, "L_Bank", "BankName") Then
And you just said the name of your module is "AddToList":
Module: AddToList
If this is indeed the case, then this would seem to be the reason your code is erroring.

Ken S.
 
Yes- I understand (slowly) but don't know how to call the module AddToList from the Event.
 
That's the whole point... you can't call a module, you call procedures (which are located in modules) - that's what the error message is telling you. What did you name your module that contains the AddToList procedure from AceMan's FAQ? If it's called AddToList - then you have a problem and you need to rename your module. If that's not the case... then, we'll go from there.

Ken S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top