模态形式拒绝是模态的 [英] Modal Form refusing to be modal

查看:67
本文介绍了模态形式拒绝是模态的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Access 2010中,我有一个表单,我从另一个表单打开,它将一个新记录添加到表中,然后刷新旧表单上的一个组合控制回到它(除非用户点击取消)。 我打开的表单闪烁但拒绝是模态,
因此控件立即恢复为关闭它的旧表单。 我已经使用了这种技术大量的时间,而且它总能奏效。 我无法解决问题 发生了什么事。 关于这种情况唯一不同的是打开
的按钮,第二个表单位于选项卡控件上。 这不是一个因素......可以吗?  这是代码(尝试使用和不使用SetFocus - 没有区别):

In Access 2010, I have a form I open from another form which adds a new record to a table and then refreshes a combo on the old form once control goes back to it (unless the user clicked cancel).  The form I'm opening flashes up but refuses to be modal, so control immediately reverts to the old form which closes it.  I've used this technique heaps of times and it's always worked.  I can't work out  what's going on.  The only different thing about this scenario is the button that opens the second form is on a tab control.  That can't be a factor...can it?   Here's the code (tried with and without SetFocus - makes no difference):

Private Sub cmdNewProduct_Click()
    If Not (CurrentProject.AllForms("frmNewProduct").IsLoaded) Then DoCmd.OpenForm "frmNewProduct", , , , acFormAdd
    With Forms("frmNewProduct")
        .DeliverableType = 2
        .IsProduct = True
        .Modal = True
        '.SetFocus
    End With
    'When we come back to here. if the user clicked Cancel, the form will no longer be loaded, which is how we know whether to refresh the product catalogue or not
    If CurrentProject.AllForms("frmNewProduct").IsLoaded Then
        cmbProduct.Requery 'update the combo
        cmbProduct = Forms("frmNewProduct").ProductID 'set the combo to the newly created item
        DoCmd.Close acForm, "frmNewProduct", acSaveNo 'the Ok button already saved it
    End If
End Sub

推荐答案

有人可以帮助我吗? 我想要做的不是火箭科学 - 我只想让一个按钮打开一个表格,然后一旦表格完成(单击取消或填写完好单击确定)然后我想要第一个表格重启
并处理发生的一切。 我可以通过打开窗体作为对话框来实现这一点,但它是Access 2010,其中选项卡式窗体都位于相同的SDI空间中,我不想突然引入对话框。 莫达尔应该按照我想要的价格完成
。 为什么不呢?
Please can someone help me?  What I'm trying to do isn't rocket science - I just want to have a button open a form and then once that form is finished (either Cancel is clicked or it's filled out and OK is clicked) I then want the first form to restart and process whatever's happened.  I can do this by opening the form as a dialog, but it's Access 2010, where tabbed forms all sit in the same SDI space and I don't want to suddenly introduce dialog boxes to the mix.  Modal is supposed to do exactly what I want.  Why isn't it?


这篇关于模态形式拒绝是模态的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆