>I had a UDF that I called from within a form method. The code opened a table and always used the current datasession for the form. I moved the code to a Container object and the table gets opened up in the default datasession when the form calls the object method instead of the active datasession for the form. Why is this? Do I have to set the datasession before opening the table? Not sure why this would be different from a UDF.
Your container object probably exists in the default DS. Whenever you call the function, the table is opened in whatever DS the UDF exists in, not DS of the form calling it. What I did was add a DSID property to my App object (oApp.DSID) and set it to the DSID of the form before calling any functions. Then, at the beginning of a function, I set the DSID to the one stored in that App property before opening tables. If oApp.DSID is zero, I consider that as not changing to a particular DSID.
Mark McCasland
Midlothian, TX USA