• Creator
    Topic
  • #4275
    sfritz
    Participant

    I have created a form and once the data has been validated, I insert a record into the database, then prompt the user if they would like to add another record via a msgbox, the problem I have is reinitalizing the form. Below is my code example:
    BabyTot_Revised.SubmitBtn.ModalResult = MROK
    myvar = Msgbox (“Do you wish to add another record?”,4 )

    if myvar = 6 then

    msgbox (“Clear the form and start again”)
    end if
    if myvar = 7 then
    BabyTot_Revised.ModalResult = MROK
    end if

    I have looked at the vbscript and wanted to use the clear method however it implies it is only valid when using it with errors. Any suggestions? Thank you in advance for your continued help and support.

  • Author
    Replies
  • #7687
    Support 1
    Participant

    Thank you for your enquiry.

    I think the Clear method you mention belongs to the Err object, and yes, this method clears the current global error state.

    There is no built-in method for clearing/initializing a Form. You will need to write your own code to initialize every field on the Form as required. Perhaps you could implement this code as a subroutine, eg. InitializeBabyTotForm(). Depending on your needs it may suit you to implement a load/save pair of subroutines, eg. LoadBabyTotForm(), SaveBabyTotForm().

    In VBScript (and any other software) development, we recommend using named constants, eg. vbYesNo rather than literal constants (‘magic’ numbers), eg. 6. This makes it much easier to understand code written by someone else. You can define your own named constants using the Const keyword – see the VBScript online help for details.

    I hope this helps.

    Regards,
    Advansys Support

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.