Question on frames and msgbox

J

Jade

Hi Everyone,

How do you code to make a frame within a form visible/hidden. I've
composed a code that when a user selects the form a message box opens
asking them if they would like to do this or that (if they answer THIS
then Frame A is visible.....if they answer That then Frame B is
visible)...bottomline both cannot be visible at the same time.

Please help....
Function Item_Open()
IntAns=MsgBox("Would you like to open a new account",_
vbQuestion+vbYesNo,"Account Request")
If IntAns=vbYes then
Set fraAcctOpen.Visible=True
Else
If IntAns=vbNo then
Set fraAcctChange.Visible=True
End If
End If
End Function

I realize there is something wrong with this code since i get the
question but when you reply well both frames appear which isn't
correct.

If anyone can offer me any guidance I'd greatly appreciate it.

Regards,
Jade
 
J

Jade

Hi Ken,

ok...tried this

Function Item_Open()
Set myInspector=Item.GetInspector
Set myPage1=myInspector.ModifiedFormPages("Customer Number Request")
Set fraAcctChange=myPage1.Controls("fraAcctChange")

IntAns=MsgBox("Would you like to open a new account",_
vbQuestion+vbYesNo,"Account Request")
If IntAns=vbYes then
fraAcctChange.Visible=True
Else
strMsg="Hello"
End If
End Function

not having much luck...help...please
 
K

Ken Slovak - [MVP - Outlook]

What's not working? Do you get the message box?

If you step the code do you get the intermediate Inspector object and
ModifiedFormPages collection and the final frame control?

You can also put in MsgBox statements for troubleshooting:

MsgBox myInspector.Caption
MsgBox myInspector.ModifiedFormPages.Count
MsgBox myPage1.Caption
MsgBox fraAcctChange.Caption

See where you're losing things.

Also, just a shot, but see if using explicit Item properties instead of
relying on the default property works any better:

Set myPage1=myInspector.ModifiedFormPages.Item("Customer Number Request")
Set fraAcctChange=myPage1.Controls.Item("fraAcctChange")
 
J

Jade

Hi Ken,

You must have wings on your back because you're definitely an
ANGEL...thank you for the troubleshooting statements...it was all I
needed to discover the problem.

Form is working fabulously.

Thanks!!!!

Jade
 

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

Top