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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compile Error: Object Required ?? 1

Status
Not open for further replies.

parsman

Programmer
Jul 15, 2003
17
US
Here's one I haven't seen. I hope somebody can help me.

I created a collection class using the Class Builder utility. I've been testing it in the development environment without a problem. When I hit Cntl+F5 to run it after a full compile, I get the subject error message.

Here's what it looks like . . the highlighted word "Add" is where it stops.


Option Explicit
'local variable to hold collection
Private mCol As Collection

Public Function Add(objNewMember As note) As String
Dim skey As String
skey = "N" & Str(objNewMember.NoteID) & "-" & Str(objNewMember.CreatedBy) & "-" & _
Str(objNewMember.NoteNbr)
'create a new object

mCol.Add objNewMember, skey

'return the object created
Set Add = skey
Set objNewMember = Nothing

End Function

I don't have a clue on what could be wrong. Can anybody help??
 
Add is a function, not an object.

The line should probably read Add =
instead of Set Add =

Are you sure you need to be setting the objNewMember to nothing here?
As it is a parameter, you could omit that line.


 
Thanks Jeff. Actually, the statement Set Add = skey was generated by the Class Builder utility. It's probable that the function was initially:

Public Function Add(objNewMember As note) As Note

. . . where Note is an object. Later, I probably changed the return to a string type:

Public Function Add(objNewMember As note) As String

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top