modal not working??

S

SuzyQ

I have a form that the user can double-click on to open another form. The
other form that opens has the modal property set to yes. I don't want the
user to return to the calling form until they have completed and closed the
form that is called. However, it's not working the way I expect. The main
form opens the secondary form ok, but the user IS able to go back to the main
form without closing the form that was called. Do you think there is form
corruption that is causing this or is the behavior that I am expecting
incorrect for the application?
 
A

Albert D. Kallal

SuzyQ said:
I have a form that the user can double-click on to open another form. The
other form that opens has the modal property set to yes. I don't want the
user to return to the calling form until they have completed and closed
the
form that is called. However, it's not working the way I expect. The
main
form opens the secondary form ok, but the user IS able to go back to the
main
form without closing the form that was called. Do you think there is form
corruption that is causing this or is the behavior that I am expecting
incorrect for the application?

Your explanation and desire as to what modal forms are supposed to
accomplish is correct, I'm not really sure why your application is behaving
incorrectly here.

I would ensure that both forms have the popup setting = no. You could try
setting the 1st main for to model, but it should not change anything here.

Also keep in mind that dialog forms and model forms and popup forms ALL
behave quite differently from each other. They all have different uses, and
you don't want to "mix up" the use of these form types in the wrong way, or
you often can get some undesired behaviors here.

The "modal" setting of the form is only available in design mode in the
other tab of the property sheet for that form. The dialog setting is only
available when you use code or macros to open the form.

So I would double check your settings here. You could try compact and
repair, or perhaps create a new blank database and import all of the forms
etc. into a new database to see if this changes anything...

You also don't mention what version of access are using here. In a2007, , I
assume perhaps that maybe you're using access 2007, and in that case I think
you have to use overlapping windows here.

Anyway, just make sure the popup settings are set = no.
 
C

Clifford Bass

Hi Suzy,

Does the code that opens it use the acDialog setting?

DoCmd.OpenForm "frmOther", , , , , acDialog

If not, that may be the problem.

Clifford Bass
 
S

SuzyQ

It was acNormal, so I changed it to acDialog and still have a problem.

Private Sub EquipmentHours_DblClick(Cancel As Integer)
DoCmd.OpenForm "frmProjectEquipmentFuel", acFormDS, , [EquipmentKey] =
Me.EquipmentKey, acFormEdit, acDialog, "Fuel for Equip: " & Me.EquipmentCode
End Sub
 
S

SuzyQ

disregard my last response. It's working now. I needed to make the change
in two places and only made it in one. I haven't yet pulled it out into it's
own procedure, but I'll do that now.

SuzyQ said:
It was acNormal, so I changed it to acDialog and still have a problem.

Private Sub EquipmentHours_DblClick(Cancel As Integer)
DoCmd.OpenForm "frmProjectEquipmentFuel", acFormDS, , [EquipmentKey] =
Me.EquipmentKey, acFormEdit, acDialog, "Fuel for Equip: " & Me.EquipmentCode
End Sub


Clifford Bass said:
Hi Suzy,

Does the code that opens it use the acDialog setting?

DoCmd.OpenForm "frmOther", , , , , acDialog

If not, that may be the problem.

Clifford Bass
 
C

Clifford Bass

Hi Suzy,

It would appear that the culprit is the acFormDS. Apparently datasheet
view cannot be used as a modal dialog. A quick test confirms this:

Private Sub cmdForm2_As_Dialog_Click()

MsgBox "Before opening form with acNormal."
DoCmd.OpenForm "Form2", acNormal, , , acFormEdit, acDialog
MsgBox "After opening form with acNormal."

MsgBox "Before opening form with acFormDS."
DoCmd.OpenForm "Form2", acFormDS, , , acFormEdit, acDialog
MsgBox "After opening form with acFormDS."

End Sub

I get the first message before the form is opened. Only when I close
the form do I get the second message. Then the third message. The form
opens again. Then the fourth message immediately after the form opens. I
would suggest if you need a datasheet view to set the form's Default View
property to Continuous forms and design the layout to mimic a datasheet.

Clifford Bass
 

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