从“附件”控件更新表单控件 [英] Updating a form control from an Attachment control

查看:118
本文介绍了从“附件”控件更新表单控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为frmSplit的拆分表单。在它上面我有一个名为"附件"的按钮。此按钮打开一个名为frmAttachment的表单。 frmAttachement具有RecordID字段,RecordName字段,链接到MainTable中附件字段
的MyAttachment附件控件,以及未绑定的  txtfilecount字段。

I have a split form called frmSplit. On it I have a button called "Attachments". This button opens a form, called frmAttachment. frmAttachement has RecordID field, RecordName field, MyAttachment attachment control linked to an attachments field in MainTable, and an unbound  txtfilecount field.

txtfilecount字段填写如下:

         Private Sub Form_Current()

         Me.txtfilecount.Value = Me.MyAttachment.AttachmentCount

End Sub

The txtfilecount field is populated as follows:
         Private Sub Form_Current()
         Me.txtfilecount.Value = Me.MyAttachment.AttachmentCount
End Sub

frmSplit每次选择新记录时都会更新frmAttachment。我无法做的工作是在splitform中的字段中显示txtfilecount的值。

frmSplit updates frmAttachment everytime a new record is selected. What I am unable to make work is to show the value of txtfilecount in a field in the splitform.

我已完成的工作  已打开frmAttachment并且当用户在frmSplit中选择记录时,使其不可见。在frmSplit上,我放了一个名为txtfield的字段并将其控制源引用为
  = [Forms]![frmAttachment]![txtfilecount]。当frmSplit打开时,它似乎在txtfield中具有正确的值,但是当我通过拆分表单选择新记录时,它不会更新txtfield。

What I've done  is open frmAttachment and make it invisible while the user selects a record in frmSplit. On frmSplit, I put a field named txtfield and referenced its control source as  =[Forms]![frmAttachment]![txtfilecount]. When frmSplit opens, it appears to have the correct value in txtfield, but when I select a new record through the split form, it does not update txtfield.

它没有给我一个错误信息。当您更改拆分表单中的记录时,它不会更新。

It is not giving me an error message. It just does not update when you change records in the split form.

Dean J. Waring

Dean J. Waring

推荐答案

嗨Dean,

你说要解决没有显示附件正确计数的问题,你打算在后台打开附件表格在拆分表单上显示计数,当你"打开"时它似乎有效。分裂形式。但是,当您选择不同的记录时
,计数不会改变。它是否正确?如果是这样,请尝试移动代码以打开附件表单,从拆分表单的打开事件到当前事件。

You said to work around the issue of not showing the correct count for the attachments, you are opening the attachment form in the background to display the count on the split form, and it seems to work when you "open" the split form. However, when you select a different record, the count does not change. Is this correct? If so, try moving your code for opening the attachment form from the Open event of the Split form to the Current event.

希望它有帮助......

Hope it helps...


这篇关于从“附件”控件更新表单控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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