General information
Category:
Coding, syntax & commands
Title:
Passing datasession or SET('DATABASE') to other form
I have a search form patterned after the Searchform class in WIZSTYLE. It uses AFIELDS() to fill a combo with the fields in a cursor, which are used to build a search expression. I wrote a method called .srchfields that removes unwanted fields (such as surrogate key fields) from the array. Now I want to add code in .srchfields to substitute field captions wherever they are non-blank. I use dbGetProp to retrieve each field's caption and put it in the combo.Recordsource. The search form object is created in the find button, then its .srchfields method is run, then I SHOW the form.
It works fine unless the calling form has a private data session. The dbGetProp function generates the error "No database is open or set as the current database". First I tried to pass the search form the value of DBC(), but that was blank for some reason. Then I tried to pass it the calling form.DataSessionID, and used SET DATASESSION TO that value. I got the same error, however. I also noted that the help for the SET DATASESSION command says "SET DATASESSION is typically used to debug forms, and should not be issued when a form is active." My search form.DataSession = 1 - default data session, and it is modal. Whatever shall I do?
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only