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

Method or data member not found

Status
Not open for further replies.

akirekab

Programmer
Aug 17, 2002
7
US
I have Access 2002 sp3
When I jump to one of the two sets of code I think, not sure cause the error is evasive, I get the error Method or data member not found. Is this a version thing or something else?

ListDivisionsByCode Me.cboDivisions
Me.lstCustomers.RowSource = CommonCode.ListCustomers("All", 0, "", False)
Me.lstCustomers.Requery
WO_Select

Or possibly this one

Me.lstCustomers.RowSource = CommonCode.ListCustomers(Me.cboDivisions, myCustomerType, mySearchName, myInactive)
Me.lstCustomers.Requery

I am new enough at advanced VBA to get in trouble a lots.
Thank you for any help
 
Please search the code for CommonCode and ListCustomers and post here.
 
Here is the Common code function:

Function ListCustomers(DivisionCode As String, Customer_Type As String, SearchName As String, Include_Inactive As Boolean)
Dim LC As String
Dim myWhere As String
myWhere = "WHERE"

LC = "SELECT * FROM qryCustomersByDivision "

If DivisionCode <> "All" Then
LC = LC & myWhere & " DivisionCode='" & DivisionCode & "' "
myWhere = "AND"
End If

Select Case LCase(Customer_Type)
Case "retail"
LC = LC & myWhere & " Retail = -1 "
myWhere = "AND"
Case "business"
LC = LC & myWhere & " Retail = 0 "
myWhere = "AND"
End Select

If Len(SearchName) > 0 Then
LC = LC & myWhere & " Name LIKE '" & SearchName & "*' "
myWhere = "AND"
End If

If Not Include_Inactive Then
LC = LC & myWhere & " Active = true "
myWhere = "AND"
End If

LC = LC & " ORDER BY SortName"

ListCustomers = LC

End Function

Thank you for looking, I appreciate it.
Ken
 
This looks ok.

Does your form have a control called lstCustomers?
 
Hmm. Have you tried stepping* through the code? This should give the exact line where the problem occurs.





--------------------------
* Create a breakpoint by pressing F9 with the cursor on one of the two problem lines. Then press F8 until the thing falls over.
 
I have tried to do that. And that is how I arrived at the possible starting point for this discussion. So back to the drawing board. I will do it again, and hope to see something else. Thank you for looking at this, at least you verified the code I sent was in order.
Ken
 
From where I stand, it looks very like there is a minor misspelling in the name of lstCustomers. You could check this with:

x= CommonCode.ListCustomers("All", 0, "", False)
 
The second parameter to the ListCustomers function is declared as a string and you're passing in a numeric value.

Try

Me.lstCustomers.RowSource = CommonCode.ListCustomers("All", "0", "", False)

(bold component highlighted what I've changed).

John
 
Is 'CommonCode' the name of the module where you've written the ListCustomers function? If so, I've never seen the name of a module actually included in the code to call a function found therein?

In other words, I don't think it should be CommonCode.ListCustomers(). I think it should be just ListCustomers()

I hesitate to post this because it can't be that simple.... My mind must be gone....

T
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top