I have 2 forms. On form 1, the user makes a selection from a table, then pushes a button which opens form 2. This is my attempt to get around not being able to filter detail tables on a form. In other words, form 1 acts as a filter. This all works fine, if form 2 isn't already open.
My question is how to check whether form 2 is open and close it if it is. Or manipulate the tables in form 2 with it open.
Member subscribes to this thread with a verified email.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
Member subscribes to this thread with a verified email.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
Member subscribes to this thread with a verified email.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
For testing I open the 2nd form from the Project Viewer. It does not have any queries. It does have a code to call the 1st form (see below). However, I usually open the 1st form separately from the Project Viewer to simulate someone starting up without realizing that they have left form 2 open. Anyway, I get the same results no matter how I open the 2 forms.
method pushButton(var eventInfo Event) var f form endVar f.open("M:\\PDOXDATA\\LOG\\COMP\\fund_search") close() endMethod
>> close
The second has almost no code. Aside from the button mentioned above, there is a simple close() button and a button that open()s another form. (I haven't pushed that button more that about once during testing.)
Form 2 is really just 3 tables. The master table is the log number, the other 2 are deposits and transfers. All of them are read-only so the form doesn't do much of anything except pull the tables together for the user to scroll through.
>>openForms testing
OK, it says it is not finding the form name.
>>Locks
Not sure what to do with this idea. Would I somehow have the second form not set locks?
So, I think the most obvious place to start is to figure out why the openForms testing doesn't find the second form.
Member subscribes to this thread with a verified email.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
Member subscribes to this thread with a verified email.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
>>write the contents of that formnames array to a text file
I know this is probably a basic procedure but it's something I don't know how to do. In looking through my books to find out how to do it, I came across two examples of using for endFor to look through enumFormNames arrays for a form name. Should I be doing that?
I tried to write a loop using Mike's example (see below) but when the syntax checker gets to the 2nd line, it stops at openForms and says "unknown method name."
for siCounter from 1 to openForms.size() if openForms(siCounter) = "sp-fund-tracking2" then msgInfo("Reminder","Form 2 was left open. Closing it.") if not f.attach("sp-fund-tracking2") then errorShow() return
else
if not f.close() then errorShow() endIf endIf
else msgStop("Error","Form name not found") return
endIf endFor
>>Do you still get the message that it doesn't find the form name?
Member subscribes to this thread with a verified email.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
Member subscribes to this thread with a verified email.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
Member subscribes to this thread with a verified email.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
Sorry, didn't finish. Anyway that code will tell you if the form is open. Then use a form variable to attach to the form. I think you can close it once it is attached. Never tried to manipulate tables that way, though. Unless someone else answers up, you may have to experiement.
Mac
[i]"A king will have his way in his own hall, be it folly or wisdom."[/i] - Gandalf
I just tested the basic code and have no problem making it work. I don't see anything wrong with your code, so I'm betting the the form was opened with a Wait, as Tony said.
Mac
[i]"A king will have his way in his own hall, be it folly or wisdom."[/i] - Gandalf
I think what Jedstar and I mean is: How was the form you want to close opened in the first place? If it was opened like this (i.e. you used a button expert to open it):
someForm.open() someform.wait()
then the WAIT might be causing the problem.
Mac
[i]"A king will have his way in his own hall, be it folly or wisdom."[/i] - Gandalf
Another thought is that you may have some code attached to the close or canClose event of the form, or some object on the form, which is preventing it from closing when it does not have focus.
Mac
[i]"A king will have his way in his own hall, be it folly or wisdom."[/i] - Gandalf
I had one other thought. If you aren't getting any error messages, then it seems your code is failing on the first IF condition. Try making this minor change and see what happens:
if openForms.contains("fund_search_step2") then if not f.attach("fund_search_step2") then errorShow() return else if not f.close() then errorShow() endIf endIf else msgStop("Error","Form name not found") return endIf
Mac
[i]"A king will have his way in his own hall, be it folly or wisdom."[/i] - Gandalf
Okay - now we are cooking. When you do your view() of the enumerated forms, look for the form name in there. Attach to that form name, which is the TITLE value of the form in the object explorer's Appearance Tab, not its actual file name.
Mac
Mac
[i]"A king will have his way in his own hall, be it folly or wisdom."[/i] - Gandalf
Okay - you never gave the forms a title, because these are defaults. The form name is everything you see there, 'Form : fund_search_step2.fsl'.
Just to simlify things a bit, try changing the title property (in the object explorer) of the 2nd form to something simple but meaningful, like: TestMe. Then try your code again, inserting that name as the form name.
Mac
[i]"A king will have his way in his own hall, be it folly or wisdom."[/i] - Gandalf
When you enumerate those forms, if the one you attach TO and try to close has opened another form, and is waiting on it, can an outside form/construct then close() it?
Well, I think with a bit more info we can narrow this down.
Also, if indeed the 'active' form was opened by 'fund_search_step2', and it is WAITing, I believe formcaller allows that second form to close the form WAITing on it.
Or, formreturn(True) (or False, depending on how you set up 'fund_search_step2') could be used to cause that waiting form to close.
Also, the only reason this should matter is if that other form (fund_search_step2) has its table(s) locked. Or a construct within the form (table/tcursor) has them open-editing/locked.
Below will enumerate open forms, and write them to 'forms.txt' in the WORKING directory:
var fNames array[] string ts textstream i longint endvar enumformnames(fNames) ts.open("forms.txt","nw") for i from 1 to fNames.size() ts.writeline(fNames) endfor ts.close()
Copy and paste the contents of forms.txt into a message here, if you would. Then we'll all be talking apples.
WINDOW: 1. A Graphical frame that enclose data ie on a computer screen. 2. A Structural frame through which the computer is ejected once the operator irritation level exceeds a critical stage. (The Hackers Dictionary)
Another Leo _ _ ___________________ _ _ We are Micro$oft You will be assimilated Resistance is futile