• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

UserForm - Compile error: Method or data member not found

Hello All,
I want to give a shout to Belleke, for helping me get this far.
I'm still learning and some of the code, I was given, I don't fully understand, which explains why I'm running into the following error and can't get past it.
Thank you in advance!

80192
 

Attachments

  • TEST_Systems Order Entry Master.xlsm
    190.6 KB · Views: 5
It is important to show us which line caused the error. Fortunately you also attached the file.

The problem is this line of code

txtSrvGrp.List = [lstSrvGrp].Value

You are trying to reference the List property of a textbox. But a textbox does not have a List property. Unfortunately I have no idea what you are trying to do here so I can't tell you how to fix it.

Also there is another compile error elsewhere:

Set ws = Worksheet("Master")

where you referenced Worksheet but it needs to be Worksheets.

Also in class dCalendar

If frmMaster.OB_01 = True Then frmMaster.txtStartDate.Value = v_label.Tag
If frmMaster.OB_02 = True Then frmMaster.txtEndDate.Value = v_label.Tag
If frmMaster.OB_03 = True Then frmMaster.txtPropDate.Value = v_label.Tag
If frmMaster.OB_04 = True Then frmMaster.txtPromDate.Value = v_label.Tag
If frmMaster.OB_05 = True Then frmMaster.txtExpDate.Value = v_label.Tag
If frmMaster.OB_06 = True Then frmMaster.txtPODate.Value = v_label.Tag
If frmMaster.OB_07 = True Then frmMaster.txtPORec.Value = v_label.Tag


There are no elements OB_0n in the form so all these lines fail compilation.

And finally, I strongly recommend to everyone that they use Option Explicit and declare variables. Doing so prevents a lot of bugs and runtime errors.
 
Since, posting this, I've had to start from scratch.
txtSrvGroup.List=[lstSrvGrp].Value - I copied this code from someone and just replaced his names with mine. Since it's not working, I removed it and will revisit this later.
Set ws = Worksheet("Master") - I fixed that.
dCalendar - I removed the Calendar completely. I really wanted a different way to manage dates, which I'll work on later.

Since I my original posting, I ran into a new issue. The following is the code I was given and it worked. The person who gave me this code, actually created the listbox search capabilities, which is awesome. However, he/she changed my naming conventions to T_00, T_01, etc., which for someone new and trying to learn, really threw me. Here's his/her code....
Code:
Private Sub LB_00_Click()
For i = 0 To 64
    Me("T_" & Format(i, "00")) = LB_00.Column(i)
Next
'T_06.value = Replace(T_06.value, ",", ".")
Cmb_00.Enabled = False
Cmb_01.Enabled = True
End Sub

So, I took his/her code and swapped out the names he/she used to make reading the code a little easier for me. However, I get a Run-Time Error 214724809 (80070057) Cannot find the specified object.
This shows his/her names vs mine
LB_00 = lstSearch
0 to 64 = 0 to 130
Cmb_00 = cmbAddNew
Cmb_01 = cmbUpdateSave
T_00 = txtShopOrdNum (This is the first column of the data table. The remaining textbox are similar, e.g., txtPONum, txtPOAmt, etc.)

Code:
Private Sub lstSearch_Click()
For i = 1 To 130
  Me("txt" & Format(i, "ShopOrdNum")) = lstSearch.Column(i)
Next
cmbAddNew.Enabled = False
cmbUpdateSave.Enabled = True
End Sub

I believe the issue is my naming convention. It is is stopping the process. I need my textbox names to have numbers.

I've attached the revised TEST file.
 

Attachments

  • TEST_Systems Order Entry Master.xlsm
    159 KB · Views: 3
Last edited:
Since I last posted, I've made some changes to my original sample file, but I'm running into the same run-time error '-2147024809 (80070057)': Cound not find the specified object. The code is long, so I've provided a screenshot showing the line of code that's throwing the error and I've attached the sample file. You'll notice I have a lot of notes. I'm new and these help me as I build out this userform. Some of the code was given to me and I'm learning to understand it.
I would so appreciate help on this.
80653
 
The error message tells you exactly what the problem is. You are looking from 1 to 120 but you do not have any textboxes numbered 1-12. The first one is TextBox13.
 
Hi! Thank you for your response. I prefer to customize the controls with 'names' vs numbered. So, my textboxes are named, i.e., txtShopOrdNum, txtSO, txtPO, etc. TextBox13 (and several others), I had not customized the names yet. So, I fixed that.

Looks like I need a revised code that is not dependent on numbers. If you have any recommendations, I would so greatly appreciate it.
Thanks again!
 
Ok, so I figured out how to clear named textboxes...Whew!
The first section of code shows the code I found here: Clear Textboxes Code
If you follow my notes in the second section of code, you'll see how I used it in my code.

Now, I have a new challenge with the error fixed. The search is not populating the textboxes. I'm going to see if I can figure this out. If not, I will start a new post.
Thank you again so very much 6StringJazzer for your help! I really appreciate the assistance I receive on this forum!

Code:
Private Sub ClearFields_Click()

    Dim ctrl As Control      ' CREATE A CONTROL OBJECT.

    ' LOOP THROUGH EACH CONTROL, CHECK IF THE CONTROL IS A TEXTBOX.
    For Each ctrl In Me.Controls
        If TypeName(ctrl) = "TextBox" Then
            ctrl.Value = ""      CLEAR THE VALUE.
        End If
    Next ctrl
End Sub

Code:
Private Sub cmbSearch_Click()
Dim sat
Dim s As Long
Dim deg1 As String
Dim deg2 As String
Dim ctrl As Control [COLOR=rgb(65, 168, 95)][B]'To fix error, I added this...[/B][/COLOR]
Sheets("Master").Activate
Application.ScreenUpdating = False
If txtSearch.Value = "" Then
MsgBox "Please enter a value", vbExclamation
txtSearch.SetFocus
Exit Sub
End If
If cboSearchItem.Value = "" Or cboSearchItem.Value = "-" Then
MsgBox "Choose a Filter Field", vbExclamation, ""
cboSearchItem.SetFocus
Exit Sub
End If
For Each ctrl In Me.Controls
If TypeName(ctrl) = "TextBox" Then
ctrl.Value = ""
End If
Next ctrl
[COLOR=rgb(65, 168, 95)][B]'To fix error, I removed this>>>[/B][/COLOR]For a = 1 To 120         'Clear textboxes(1-120)
[B][COLOR=rgb(65, 168, 95)]'To fix error, I removed this>>>[/COLOR][/B]Controls("textbox" & a) = "" '***************RUNTIME ERROR 80070057: COULD NOT FIND SPECIFIED OBJECT*********************
[B][COLOR=rgb(65, 168, 95)]'To fix error, I removed this>>>[/COLOR][/B]Next
With lstMaster
With lstMaster
.Clear
.ColumnCount = 120
.ColumnWidths = "70;70;70;70;70;70;70;35;35;70;70;70;70;70;70;70;70;85;35;70;70;70;85;70;70;70;70;70;35;35;70;70;70;35;35;70;35;35;70;70;35;70;35;35;35;35;35;70;70;70;70;70;70;70;70;70;70;70;70;70;70;70;70;85;70;70;70;70;70;70;70;70;70;70;70;70;70;70;70;70;70;70;85;70;35;70;70;70;70;70;35;35;35;35;35;70;70;70;70;35;70;70;70;70;35;35;35;70;35;70;70;70;70;70;70;70;70;70;70;70"
End With
Call Main 'Progress Bar
'Search for Shop Order Number'
deg2 = txtSearch.Value
Select Case cboSearchItem.Value
Case "Shop Order Number"
For sat = 2 To Cells(Rows.Count, 1).End(xlUp).Row
deg1 = Cells(sat, "A")
If UCase(deg1) Like UCase(deg2) & "*" Then
lstMaster.AddItem 'All textboxes listed below go from 0-119, NOT 1-120.
lstMaster.List(s, 0) = Cells(sat, "A")
lstMaster.List(s, 1) = Cells(sat, "B")
lstMaster.List(s, 2) = Cells(sat, "C")
lstMaster.List(s, 3) = Cells(sat, "D")
lstMaster.List(s, 4) = Cells(sat, "E")
lstMaster.List(s, 5) = Cells(sat, "F")
lstMaster.List(s, 6) = Cells(sat, "G")
lstMaster.List(s, 7) = Cells(sat, "H")
lstMaster.List(s, 8) = Cells(sat, "I")
lstMaster.List(s, 9) = Cells(sat, "J")
lstMaster.List(s, 10) = Cells(sat, "K")
lstMaster.List(s, 11) = Cells(sat, "L")
lstMaster.List(s, 12) = Cells(sat, "M")
lstMaster.List(s, 13) = Cells(sat, "N")
lstMaster.List(s, 14) = Cells(sat, "O")
lstMaster.List(s, 15) = Cells(sat, "P")
lstMaster.List(s, 16) = Cells(sat, "Q")
lstMaster.List(s, 17) = Cells(sat, "R")
lstMaster.List(s, 18) = Cells(sat, "S")
lstMaster.List(s, 19) = Cells(sat, "T")
lstMaster.List(s, 20) = Cells(sat, "U")
lstMaster.List(s, 21) = Cells(sat, "V")
lstMaster.List(s, 22) = Cells(sat, "W")
lstMaster.List(s, 23) = Cells(sat, "X")
lstMaster.List(s, 24) = Cells(sat, "Y")
lstMaster.List(s, 25) = Cells(sat, "Z")
lstMaster.List(s, 26) = Cells(sat, "AA")
lstMaster.List(s, 27) = Cells(sat, "AB")
lstMaster.List(s, 28) = Cells(sat, "AC")
lstMaster.List(s, 29) = Cells(sat, "AD")
lstMaster.List(s, 30) = Cells(sat, "AE")
lstMaster.List(s, 31) = Cells(sat, "AF")
lstMaster.List(s, 32) = Cells(sat, "AG")
lstMaster.List(s, 33) = Cells(sat, "AH")
lstMaster.List(s, 34) = Cells(sat, "AI")
lstMaster.List(s, 35) = Cells(sat, "AJ")
lstMaster.List(s, 36) = Cells(sat, "AK")
lstMaster.List(s, 37) = Cells(sat, "AL")
lstMaster.List(s, 38) = Cells(sat, "AM")
lstMaster.List(s, 39) = Cells(sat, "AN")
lstMaster.List(s, 40) = Cells(sat, "AO")
lstMaster.List(s, 41) = Cells(sat, "AP")
lstMaster.List(s, 42) = Cells(sat, "AQ")
lstMaster.List(s, 43) = Cells(sat, "AR")
lstMaster.List(s, 44) = Cells(sat, "AS")
lstMaster.List(s, 45) = Cells(sat, "AT")
lstMaster.List(s, 46) = Cells(sat, "AU")
lstMaster.List(s, 47) = Cells(sat, "AV")
lstMaster.List(s, 48) = Cells(sat, "AW")
lstMaster.List(s, 49) = Cells(sat, "AX")
lstMaster.List(s, 50) = Cells(sat, "AY")
lstMaster.List(s, 51) = Cells(sat, "AZ")
lstMaster.List(s, 52) = Cells(sat, "BA")
lstMaster.List(s, 53) = Cells(sat, "BB")
lstMaster.List(s, 54) = Cells(sat, "BC")
lstMaster.List(s, 55) = Cells(sat, "BD")
lstMaster.List(s, 56) = Cells(sat, "BE")
lstMaster.List(s, 57) = Cells(sat, "BF")
lstMaster.List(s, 58) = Cells(sat, "BG")
lstMaster.List(s, 59) = Cells(sat, "BH")
lstMaster.List(s, 60) = Cells(sat, "BI")
lstMaster.List(s, 61) = Cells(sat, "BJ")
lstMaster.List(s, 62) = Cells(sat, "BK")
lstMaster.List(s, 63) = Cells(sat, "BL")
lstMaster.List(s, 64) = Cells(sat, "BM")
lstMaster.List(s, 65) = Cells(sat, "BN")
lstMaster.List(s, 66) = Cells(sat, "BO")
lstMaster.List(s, 67) = Cells(sat, "BP")
lstMaster.List(s, 68) = Cells(sat, "BQ")
lstMaster.List(s, 69) = Cells(sat, "BR")
lstMaster.List(s, 70) = Cells(sat, "BS")
lstMaster.List(s, 71) = Cells(sat, "BT")
lstMaster.List(s, 72) = Cells(sat, "BU")
lstMaster.List(s, 73) = Cells(sat, "BV")
lstMaster.List(s, 74) = Cells(sat, "BW")
lstMaster.List(s, 75) = Cells(sat, "BX")
lstMaster.List(s, 76) = Cells(sat, "BY")
lstMaster.List(s, 77) = Cells(sat, "BZ")
lstMaster.List(s, 78) = Cells(sat, "CA")
lstMaster.List(s, 79) = Cells(sat, "CB")
lstMaster.List(s, 80) = Cells(sat, "CC")
lstMaster.List(s, 81) = Cells(sat, "CD")
lstMaster.List(s, 82) = Cells(sat, "CE")
lstMaster.List(s, 83) = Cells(sat, "CF")
lstMaster.List(s, 84) = Cells(sat, "CG")
lstMaster.List(s, 85) = Cells(sat, "CH")
lstMaster.List(s, 86) = Cells(sat, "CI")
lstMaster.List(s, 87) = Cells(sat, "CJ")
lstMaster.List(s, 88) = Cells(sat, "CK")
lstMaster.List(s, 89) = Cells(sat, "CL")
lstMaster.List(s, 90) = Cells(sat, "CM")
lstMaster.List(s, 91) = Cells(sat, "CN")
lstMaster.List(s, 92) = Cells(sat, "CO")
lstMaster.List(s, 93) = Cells(sat, "CP")
lstMaster.List(s, 94) = Cells(sat, "CQ")
lstMaster.List(s, 95) = Cells(sat, "CR")
lstMaster.List(s, 96) = Cells(sat, "CS")
lstMaster.List(s, 97) = Cells(sat, "CT")
lstMaster.List(s, 98) = Cells(sat, "CU")
lstMaster.List(s, 99) = Cells(sat, "CV")
lstMaster.List(s, 100) = Cells(sat, "CW")
lstMaster.List(s, 101) = Cells(sat, "CX")
lstMaster.List(s, 102) = Cells(sat, "CY")
lstMaster.List(s, 103) = Cells(sat, "CZ")
lstMaster.List(s, 104) = Cells(sat, "DA")
lstMaster.List(s, 105) = Cells(sat, "DB")
lstMaster.List(s, 106) = Cells(sat, "DC")
lstMaster.List(s, 107) = Cells(sat, "DD")
lstMaster.List(s, 108) = Cells(sat, "DE")
lstMaster.List(s, 109) = Cells(sat, "DF")
lstMaster.List(s, 110) = Cells(sat, "DG")
lstMaster.List(s, 111) = Cells(sat, "DH")
lstMaster.List(s, 112) = Cells(sat, "DI")
lstMaster.List(s, 113) = Cells(sat, "DJ")
lstMaster.List(s, 114) = Cells(sat, "DK")
lstMaster.List(s, 115) = Cells(sat, "DL")
lstMaster.List(s, 116) = Cells(sat, "DM")
lstMaster.List(s, 117) = Cells(sat, "DN")
lstMaster.List(s, 118) = Cells(sat, "DO")
lstMaster.List(s, 119) = Cells(sat, "DP")
s = s + 1
End If: Next
.......
 
Back
Top