
Forms Collection: Using it to Open Forms by Passing the Form Name as a String Variable
Thanks for the pointer - I had completely missed this in my trawl of the
support sites, and it certainly explains what is happening. Unfortunately
the suggested workaround doesn't entirely solve our problem, and given that
there is no short term forecast of the bug being fixed we have had to adopt
a different approach, but at least we now know where we stand.
Thanks again
David
Quote:
>David,
>Check out KB article Q194912.
>--
>HTH
>VB-Joker
>PLEASE post ALL replies to newsgroup!
>>In an appliocation I am working on I have developed a sub-routine that
will
>>open any form requested by the calling application. It works by adding
the
>>name of the requested form (passed as a string variable) to the Forms
>>collection.
>>the relevant code is something like this:
>>Sub OpenForm(byVal strFormName as String)
>>dim frm as Form, i as Integer
>> 'check if the form is already open
>> For i = 0 To Forms.Count - 1
>> If Forms(i).Name = strFormName Then
>> Forms(i).Show
>> Exit Sub
>> End If
>> Next i
>> 'if not open a new one
>> Forms.Add strFormName
>> Set frm = Forms(Forms.Count - 1)
>> frm.Show 0
>>End Sub
>>This works absolutely fine as long as the application is run from the VB
>>project environment. as soon as I make an .exe it stops working. The
>>application doesn't give an error, and it doesn't hang up. It just stops
>>executing the function at the "Forms.Add strFormName" statement, and
passes
>>control back to the calling application without executing the following
>>statement.
>>I am at a loss to understand what is happening here. Any ideas would be
>>welcome.