Setting Border Style of a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I have a form (form B) that I need to open from two different forms (say
form A and form C). The problem I am facing is that if I open the form B from
Form A then I want form B to be opened as a frameless window since I want it
to be displayed within the same window as form A. However, when it is opened
from form C I want it to be opened with border style as 2. Is it possible to
do this? If so how do I do this? I thought I could manipulate the border
style but I am not sure how to do this? Any help in resolving this issue is
appreciated.
Thanks
 
MS,
Use the OpenArgs argument in the OpenForm method.
From A to B use an OpenArg like "FromA"
From C to B use "FromC"

Form B OnOpen event can determine what form opened it, and operate on the border
(BoredrStyle?) accordingly. Given that the BorderStyle is in one state or the other by
design, you'd only have to alter it for either the call from A or C.
If OpenArgs = "FromA" Then
'hide the border...
End if
--
hth
Al Campagna
Candia Computer Consulting
Microsoft Access MVP - Candia, NH USA
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
Unfortunately, the BorderStyle property can only be set while the form's
open in Design mode, so I don't believe this approach will work.

I'm not sure there really is an easy solution to this problem.
 
Hi
I have a form (form B) that I need to open from two different forms (say
form A and form C). The problem I am facing is that if I open the form B from
Form A then I want form B to be opened as a frameless window since I want it
to be displayed within the same window as form A. However, when it is opened
from form C I want it to be opened with border style as 2. Is it possible to
do this? If so how do I do this? I thought I could manipulate the border
style but I am not sure how to do this? Any help in resolving this issue is
appreciated.
Thanks

Open the form first in design view, change the BorderStyle to what
ever value you wish. Save the change. Open the form:

DoCmd.OpenForm "FormB", acDesign, , , , acHidden
Forms!FormB.BorderStyle = 1 ' or 0 or 2 or 3
DoCmd.Close acForm, "FormB", acSaveYes

DoCmd.OpenForm "FormB"
 
Douglas,
I should have tested... Looks like the last OP response bears out what you say.
Fred's reply "seems" to be the same approach as mine... only from the calling form. If
I get a chance I'll test Fred's suggestion out.
Thanks Douglas,
--
Al Campagna
Candia Computer Consulting
Microsoft Access MVP - Candia, NH USA
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
I was going to suggest what Fred suggested, but only have Access 97
available at the moment so couldn't test properly.

My concern is that you're trying to make design changes. For those
ill-implemented projects where users are sharing the same database, that
might be an issue.
 
Al said:
Douglas,
I should have tested... Looks like the last OP response bears out what you say.
Fred's reply "seems" to be the same approach as mine... only from the calling form. If
I get a chance I'll test Fred's suggestion out.


Fred's approach does the change in design view so it will
work ... BUT, making design changes at runtime is a
dangerous operation, especially for the heavy duty form and
report objects.
 
Fred,
Thanks for your suggestion. It worked.

Marsh/Doug/Al,
Thanks to you all for responding to my question. Here is what I did.
I opened the form in design mode, set my border style and then reopened it
in normal mode. In the close of the form B I changed my docmd to not save
changes.
This works beautifully for my application which is a single user
installation but I do agree with the concerns you all voiced about making
design changes during runtime. Once again appreciate much for all your
responses. Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top