| | |
Run-Time Error 424
![]() |
•
•
Join Date: Apr 2005
Posts: 4
Reputation:
Solved Threads: 0
I am trying to use an IF statement to enable/disable command buttons; however, I get the following error message "Run Time Error '424': Object Required". The "cmdDeptStoresMC.Enabled=True" is highlighted in yellow when I run the code. Please assist. Below is my code:
Sub Check_AccessRights()
Dim X As String
Dim Y As String
X = EssVCell(Null, "Year Total", "MC", "Business Type", "Accounts", "Departments")
Y = EssVCell(Null, "Year Total", "OR", "Business Type", "Accounts", "Departments")
If X = "#No Access" Then
cmdDeptStoresMC.Enabled = False
cmdRetailStoresMC.Enabled = False
Else
cmdDeptStoresMC.Enabled = True
cmdRetailStoresMC.Enabled = True
End If
If Y = "#No Access" Then
cmdDeptStoresOR.Enabled = False
cmdRetailStoresOR.Enabled = False
Else
cmdDeptStoresOR.Enabled = True
cmdRetailStoresOR.Enabled = True
End If
End Sub
Sub Check_AccessRights()
Dim X As String
Dim Y As String
X = EssVCell(Null, "Year Total", "MC", "Business Type", "Accounts", "Departments")
Y = EssVCell(Null, "Year Total", "OR", "Business Type", "Accounts", "Departments")
If X = "#No Access" Then
cmdDeptStoresMC.Enabled = False
cmdRetailStoresMC.Enabled = False
Else
cmdDeptStoresMC.Enabled = True
cmdRetailStoresMC.Enabled = True
End If
If Y = "#No Access" Then
cmdDeptStoresOR.Enabled = False
cmdRetailStoresOR.Enabled = False
Else
cmdDeptStoresOR.Enabled = True
cmdRetailStoresOR.Enabled = True
End If
End Sub
•
•
Join Date: Mar 2005
Posts: 32
Reputation:
Solved Threads: 0
Hello again,
No offence but I don't download anything to my computer unless I have to. However run time error 424 on my version of VB says "form not found". Please check the form that has the command button on you were refering to is in memory. If the form has not been loaded, or has been unloaded before the code referrs to it you will get the message you have posted about. VB cannot find the command button. Maybe your code (to do with one form) is referring to a command button on another form. If that is so then I'll have to have a think about it.
Regards.
No offence but I don't download anything to my computer unless I have to. However run time error 424 on my version of VB says "form not found". Please check the form that has the command button on you were refering to is in memory. If the form has not been loaded, or has been unloaded before the code referrs to it you will get the message you have posted about. VB cannot find the command button. Maybe your code (to do with one form) is referring to a command button on another form. If that is so then I'll have to have a think about it.
Regards.
•
•
Join Date: Mar 2005
Posts: 32
Reputation:
Solved Threads: 0
Referencing the sheet name (i.e form) re-loads the form putting the command button in memory. The command button's form was not in memory therefore the button was not there as far as vb could find. You should note that VB is not always correct and I (and many others) have had similar problems where then answer is far more more "weird". So 98 times out of 100 the VB query is right. When it is the other 2 your hair starts falling out!!
Cheers.
Cheers.
![]() |
Similar Threads
- Run-time error '5' (Windows NT / 2000 / XP)
- Run-time Error when printing Array Contents. (C)
- "Run time error, do you wish to debug?" (Web Browsers)
- Run-Time Error..? (Windows NT / 2000 / XP)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: help with datagrid in vb.net
- Next Thread: tranmit sound
| Thread Tools | Search this Thread |
* 6 2007 access activex add age basic beginner birth bmp calculator cd cells.find click client code college connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit excel excelmacro file filename form header iamthwee image inboxinvb internetfiledownload listbox listview liveperson login looping microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading refresh remotesqlserverdatabase report save search sendbyte sites sql sql2008 sqlserver subroutine tags time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






