Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Another COMCodeBook error
Message
General information
Forum:
Visual FoxPro
Category:
COMCodebook
Title:
Another COMCodeBook error
Miscellaneous
Thread ID:
00729433
Message ID:
00729433
Views:
59
I used the ComCodeBook wizard to setup an application for testing. I placed the following code in the avalidators.prg program:
  Function vldUsrname(tcValue, tlPreStatus, roMessage)
    Local llRetVal
    llRetVal=.T.

    *-- NOTE: You will need to fill in this method
    *--       if you want validation on field USRNAME of table USER
    *
    * It must be a Present
    IF llRetVal AND (ISNULL(tcValue) OR EMPTY(tcValue))
      llRetVal = .F.
      IF VARTYPE(roMessage) = "O"
        roMessage.AddMessage("UserEmptyUsrName", THIS.NAME )
      ENDIF
    ENDIF
    * It must be character
    IF llRetVal AND (VARTYPE(tcValue) # 'C')
      llRetVal = .F.
      IF VARTYPE(roMessage) = "O"
        roMessage.AddMessage("UserNonCharacterUsrName", THIS.NAME )
      ENDIF
    ENDIF
    * It must be no more than 18 characters
    IF llRetVal AND (ALLTRIM(LEN(tcValue)) > 18)
      llRetVal = .F.
      IF VARTYPE(roMessage) = "O"
        roMessage.AddMessage("UserTooLongUsrName", THIS.NAME )
      ENDIF
    ENDIF

    Return llRetVal
  EndFunc
When ComCodeBook reaches the line roMessage.AddMessage("UserEmptyUsrName", THIS.NAME ) it generates an error:
Error in RMCONTROLLER::AUTOMATICSAVE() Line 428
Error Number: 1429

1429
OLE IDispatch exception code 1429 from User: ~Error: 1429 Line: 405 User::Validate() OLE IDispatch exception code 302 from Visual FoxPro for Windows: Data type mismatch.....
~Error: 1429 Line: 405 User::Validate() OLE IDispatch exception code 302 from Visual FoxPro for Windows: Data type mismatch...
User
User
0
1429
I added the record to the MsgSvc table and placed the 'UserEmptyUsrName' as the key and put the return text in the cOriginal field. Since this is all that the COMCodeBook document told me to do, I am stumped as to why the validation is erroring out. Any help would be appreciated.
Bret Hobbs

"We'd have been called juvenile delinquents only our neighborhood couldn't afford a sociologist." Bob Hope
Next
Reply
Map
View

Click here to load this message in the networking platform