• Creator
  • #4299

    Hi There,

    Thank you once again for your help regarding Modal results, I am using Formativ 2.0 and your solution worked well. I am continuing to write my database application and I am successful from a menu selection prompting the user to enter search criteria, and then loading the data into a listview to be then selected and edited. When I click on the row I want to edit, I want to take the contents from the database record, load it into a form and allow the user to make changes, at that point it appears that the ADOObj is no longer accessible, do I need to create a new query using the information from the listview to load the form to edit the data?

    I am trying to create a form based application similar to the example shown in this forum entry:

    Forum Entry – ACCESS

    Does such an example exist? or am I one the right track?

    One more question regarding rzRadiogroup, the index is not stored just the text, I am assuming I need to loop thru the radiogroup and when I find the matching text save the index number and display it?

    Sorry for so many questions, I quite enjoy using this product but I am still very new.


  • Author
  • #7761
    Support 1

    You are welcome; we are always happy to help whenever possible with developers’ questions.

    I think ADOObj is no longer accessible because the variable used to reference this object goes out of scope. You will notice in the example you mention that Sub Main() declares the local variable:

      dim iADOObj

    Also in Sub Main(), this variable is passed to other subroutines which work with the database connection, eg.

      case Btn5 EditRecord(iADOObj)

    By passing the object reference to each subroutine that needs the reference, the solution ensures it is always accessible until the time comes to close the connection.

    An alternative method is to declare a global variable (outside all subroutines/classes), usually at the beginning of the source code – before Sub Main(). Then all subroutines and class methods have access to the variable.

    On your question about RzRadioGroup, I think it would be easier if the index (not the text) is stored in the database. This would help with supporting different human languages; then the text only appears in the user interface.

    However, if your existing database stores the text, you will have to search the radio group for the item text to determine its index. If there are many items and the search is slow, you could add a “lookup table” to your solution. This might be a StringList object initialized from the radio group:

      dim I
      dim iLookup
      ' Notice how the index (I) of each radio item is stored in the StringList
      ' as the Object associated with the item text:
      set iLookup = Utilities.StringList
      iLookup.Sorted = true
      for I = 0 to RadioGroup1.Items.Count - 1
        call iLookup.AddObject(RadioGroup1.Items(I), I)

    Then, to look up the index for a given item’s text:

      dim I
      if iLookup.Find(iItemText, I) then
        RadioGroup1.ItemIndex = iLookup.Objects(I)
        RadioGroup1.ItemIndex = 0
      end if

    See the Formativ Language Guide for details on using StringList.

    I hope this helps.

    Advansys Support

    [This message was edited by Support 1 on October 23, 2006 at 05:52 PM.]

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