question

OscarRoark-0576 avatar image
0 Votes"
OscarRoark-0576 asked OscarRoark-0576 commented

"AddItem" Method missing from Drop Down Menu

We have a problem in VBA code that is running in GE iFix Version 6.1 on Windows Server 2016. The code itself was imported from a previous install using iFix version 5.8 and has been running without a problem for years. The code itself doesn't seem to be the problem. The problem began when a new hard drive was installed and the operating system and software had to be reloaded. Now when the Picture containing the code is called we get 'Run-time Error '438': Object doesn't support the property or method' When we run the debugger the line ComboBox21.AddItem "Sunday" is highlighted. If we delete ".AddItem" and reenter the "." the method or property drop-down box appears but "AddItem" is not an available option. The other selections are still available but AddItem is missing. We have tried installing Microsoft Office 2013 and reinstalling GE iFix. Does anybody have any ideas? Private Sub CFixPicture_Initialize() user.varPreviousPicture.CurrentValue = user.varCurrentPicture.CurrentValue user.varCurrentPicture.CurrentValue = Me.Name ComboBox21.AddItem "Sunday" ComboBox21.AddItem "Monday" ComboBox21.AddItem "Tuesday" ComboBox21.AddItem "Wednesday" ComboBox21.AddItem "Thursday" ComboBox21.AddItem "Friday" ComboBox21.AddItem "Saturday" ComboBox21.AddItem "Disabled" End Sub

office-vba-dev
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Oscar

Thank you for contacting Microsoft Open Specifications Support. It appeared your question is not related to Open Specifications outline here Open Specifications. I removed the tag Openspecs-questions, and added tag [office-vba-dev] for VBA related question. You might also consider contacting GE iFix support.

I did found out there is an article that talks about how to resolve Run-time-error-438 with VBA. https://www.techinpost.com/how-fix-solve-microsoft-run-time-error-438-windows-code-problem/#:~:text=This%20Microsoft%20Visual%20Basic%20Runtime%20Error%20438%20VBA,you%20are%20trying%20to%20execute%20the%20BW%20query. You might want to go through each of steps outlined in the article to see if any of them would resolve the issue on your system.


1 Vote 1 ·

Thank you for pointing me in the right direction!

0 Votes 0 ·

Several hours of research led us to the following statement in the Proficy* HMI/SCADA - iFIX Using VisconX R-1 documentation. The problem presented it self when we were converting a program from iFix version 5.8 to 6.1. The problem is now resolved.
Hopefully this will help someone else in the future.

Planning Your Database Write

IMPORTANT (iFIX USERS ONLY): Before you can write to a database you must have the VisiconX Writes application feature added to your user and/or group account. Also, if the data controls you created in a previous version of
iFIX were performing database writes, they will no longer work; you must add the VisiconX Writes application feature to your user and/or group account. For more information, see Application Features in the iFIX Implementing Security e-book.


0 Votes 0 ·
HungChunYu-3579 avatar image
1 Vote"
HungChunYu-3579 answered OscarRoark-0576 commented

Hi Oscar

Check out the following post from GE https://www.ge.com/digital/documentation/ifix/version61/Subsystems/IPIiFIX/content/ipi_notes.htm

In particular following section

Supporting VBA 6.5 After an Upgrade
In VBA 6.5, certain event parameter data types are interpreted differently than in earlier VBA version. For instance, one of these data types is the VBA ErrObject. The VisiconX Data Control uses the ErrObject data type in two of its events.

If a picture created with an earlier version of iFIX contains a VisiconX Data Control, and also contains VBA 5.5 scripts added for the VisiconX Data Control's ErrorOccurred event or ExecuteComplete event, when the picture is opened in iFIX 6.1, it will generate a compiler error indicating an invalid character '_'.

This occurs because the ErrObject in VBA 5.5 is declared as type "VBA._ErrObject", and in VBA 6.5, it is declared simply as "ErrObject".

To correct the compiler problem and make the scripts function correctly, make the following changes to the event declarations:

iFIX 2.21 and earlier with VBA 5.5:

Private Sub vxData1_ErrorOccurred(pError As VBA._ErrObject)
End Sub

iFIX 6.1 with VBA 6.5:

Private Sub vxData1_ErrorOccurred(pError As ErrObject)
End Sub

iFIX 2.21 and earlier with VBA 5.5:

Private Sub vxData1_ExecuteComplete(pStatus As VBA._ErrObject, sQuery As String)
End Sub

iFIX 6.1 with VBA 6.35:

Private Sub vxData1_ExecuteComplete(pStatus As ErrObject, sQuery As String)
End Sub

NOTE: This problem may occur with other ActiveX controls and data types that GE has not directly encountered. If you see problems, you should insert the control into a new picture, go to the VBA Editor, and examine the syntax used to declare events for the control in the new picture. Use the information provided in this section to edit the event declarations in the existing picture.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you for the information. It suggests a new area to search for the cause of the problem. I will post any updates if we find a solution or more information on the problem.

0 Votes 0 ·
OscarRoark-0576 avatar image
0 Votes"
OscarRoark-0576 answered

I have made some progress in resolving the issue I have described. This is what I have found so far:

  1. ComboBox21 in the above code is an ActiveX control.

  2. The AddItem method that was previously part of that ActiveX control has either been removed or is hidden. There were no changes made to the code to make that happen thus I have to assume the original installation source code has been damaged or something else occurred.

  3. The Properties option is greyed out for that ActiveX control thus I can't determine whether I can re-add AddItem to the control. The original developer of the code may have protected it to prevent modifications.

  4. Hiding or Unhiding the AddItem method doesn't have any effect on the code execution.






5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

OssieMac avatar image
0 Votes"
OssieMac answered

@OscarRoark-0576,

Have you tried deleting the ComboBox and re-creating it and see if the code works?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.