I have created an application that keeps track of my sales while on the road, basicly it is an specialized invoicing / inventory control situation, similar to the Invoice example application that is shipped with A5; so similar in fact I have used some of the code from it and subbed the names of my forms etc. as reqired.
The following code is attached to the OnExit action of the MainMenu form (I followed the example in Invoice). All goes well until "OrderMain" is passed to the function Close_if_Exists, then an error message reading "Argument is an incorrect data type" pops up, retry, ignore buttons do not allow script to continue, and if abort is pressed, A5 packs it in totally with the message that "This program has performed an illegal operation and will be shut down"
The thing that has me stumped is why is it just the one form that causes the proplem?
Thanks in advance for any help given.
'Calls global function to close all open forms
'before restoring control panel.
close_if_exists("CustomerMain")
close_if_exists("InventoryMain")
close_if_exists("OrderMain")
close_if_exists("TitleMain")
controlpanel.show()
controlpanel.activate()
''
'' CLOSE_IF_EXISTS()
'' Test is an object exists and if so closes it
''
'' Parameters:
'' name: The name of the object to close
''
function close_if_exists as N(name as C)
DIM op as P
''
'' Get the object pointer for the specified object
''
op = obj(name)
''
'' If the object pointer is valid then an object was found and we can close it.
''
if is_object(op)
op.close()
end if
end function
The following code is attached to the OnExit action of the MainMenu form (I followed the example in Invoice). All goes well until "OrderMain" is passed to the function Close_if_Exists, then an error message reading "Argument is an incorrect data type" pops up, retry, ignore buttons do not allow script to continue, and if abort is pressed, A5 packs it in totally with the message that "This program has performed an illegal operation and will be shut down"
The thing that has me stumped is why is it just the one form that causes the proplem?
Thanks in advance for any help given.
'Calls global function to close all open forms
'before restoring control panel.
close_if_exists("CustomerMain")
close_if_exists("InventoryMain")
close_if_exists("OrderMain")
close_if_exists("TitleMain")
controlpanel.show()
controlpanel.activate()
''
'' CLOSE_IF_EXISTS()
'' Test is an object exists and if so closes it
''
'' Parameters:
'' name: The name of the object to close
''
function close_if_exists as N(name as C)
DIM op as P
''
'' Get the object pointer for the specified object
''
op = obj(name)
''
'' If the object pointer is valid then an object was found and we can close it.
''
if is_object(op)
op.close()
end if
end function
Comment