PDA

View Full Version : [SOLVED] 424 Error, but object is in place



Snaad
08-03-2016, 11:48 PM
Hi guys,

I'm pretty new to VBA but learning quickly. BUT, I have an error and can't seem to find out what's going wrong.

I have my button, with the following macro:



Sub NewRoute55_Click()


AddRoute55.Show


End Sub




Which should show the said AddRoute55 form. Except it doesn't. The form is named AddRoute55, so that should match up. The form has the following code:


Private Sub UserForm_Initialize()


'Empty Status
StatusBox.Clear


'Fill StatusBox
With StatusBox
.AddItem "Received"
.AddItem "Returned to PM"
.AddItem "In Progress"
.AddItem "On Hold"
.AddItem "Complete"
.AddItem "Closed"
.AddItem "RFC"
End With




'Empty BTBox
BTBox.Clear


'Fill BTBox
With BTBox
.AddItem "Run"
.AddItem "Change"
End With


'Empty DomainBox
DomainBox.Clear


'Fill DomainBox
With DomainBox
.AddItem "AMS NL"
.AddItem "AMS INT"
.AddItem "EUS"
.AddItem "IPS"
.AddItem "NGC"
.AddItem "Office"
.AddItem "SM"
End With


'Empty AIMSBox
AIMSBox.Value = ""


'Empty ProjectCoedeBox
ProjectCodeBox.Value = ""


'Empty PMBox
PMBox.Value = ""


'Empty POBox
POBox.Value = ""


'Empty VendorBox
VendorBox.Value = ""


'Set No FTR as default
FTRButton2.Value = True


'Empty OrderReceivedBox
OrderReceivedBox.Value = ""


'Empty OrderProcessedBox
OrderProcessedBox.Value = ""


'Empty SSDMBox
SSDMBox.Value = ""


'Empty P2PBox
P2PBox.Value = ""


'Empty CustomerBox
CustomerBox.Value = ""


'Empty PMABox
PMABox.Value = ""


'Empty SPBox
SPBox.Value = ""




End Sub


If you like more info or this helps out, you can download the file from my personal website, but I can't post links yet:yes

Please help me understand what I'm doing wrong here.:think:

Thanks in advance!

GTO
08-04-2016, 05:01 AM
Click the Go Advanced button. Below the reply text box you will see the Attachments section and a Manage Attachments button. You can upload your file here.

Snaad
08-04-2016, 05:15 AM
16788

Thanks for that! Here is the file:)

GTO
08-04-2016, 05:42 AM
Which should show the said AddRoute55 form. Except it doesn't. The form is named AddRoute55, so that should match up. The form has the following code:


Private Sub UserForm_Initialize()


'...code...

'Empty ProjectCoedeBox
ProjectCodeBox.Value = ""

'...code...

End Sub


Please help me understand what I'm doing wrong here.

Thanks in advance!

You did an OOPSIE...

You have a text box named ProjectNameBox. I don't see a control named ProjectCodeBox, so I'll bet that is the issue.

In regards to finding the error, press the Debug button instead of quitting. Then slowly press F8 until you get to where the missing object becomes apparent.

To avoid the error in the first place, when typing the control names in, qualify (preface) them with the Me keyword and a stop (period). You will see that upon typing the stop, all of the userform's properties are displayed, including your controls. Makes it a lot harder to misspell or refer to a non-existent control :cloud9:

Hope that helps,

Mark

Snaad
08-04-2016, 06:20 AM
Damn, that puts me to place:) Feel a little stupid now. Thanks man, you've helped me so much!! And thanks for the secondary tips:)

GTO
08-04-2016, 06:28 AM
You are most welcome and thank you for the feedback. Trust me, I make much bigger mistakes and stare until I am nearly drooling in a coma-like state sometimes, just not seeing the forest for the trees.

BTW, I missed seeing that you just joined, so a big WELCOME to VBAExpress:hi:

Mark

Snaad
08-04-2016, 06:35 AM
You are most welcome and thank you for the feedback. Trust me, I make much bigger mistakes and stare until I am nearly drooling in a coma-like state sometimes, just not seeing the forest for the trees.

BTW, I missed seeing that you just joined, so a big WELCOME to VBAExpress:hi:

Mark
Thank you! I'll probably be a regular here if it keeps going this way, ha!

Thanks again for the help!

Sander

snb
08-04-2016, 07:17 AM
Kijk ook eens hier:

http://www.snb-vba.eu/VBA_Fill_combobox_listbox.html