如何检查子窗体是否脏 [英] How to check if subform is dirty

查看:58
本文介绍了如何检查子窗体是否脏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Howdy all。

感谢你的帮助我遇到了几个问题:


我想确定是否有访问子表格( subformVisits)有一个新的

记录或已被更改,即脏。包含子表单的表单是

名为Clients。


我在添加客户端btn中有此代码:

如果表单!Clients.subformVisits!VisitDirty = True然后

MsgBox访问子表单很脏!

否则

MsgBox"问题。 subform not dirty

结束如果

但它显示错误的应用程序定义或对象定义错误。


现场VisitDirty是一个未受约束的&在subformVisits的详细信息部分中,不可见字段具有True / False

格式。它的代码是:


Private Sub VisitDirty_AfterUpdate()

''查看子表单是否脏,即已更改或新记录

如果Me.Dirty那么

Me.VisitDirty = True

结束如果


End Sub


未绑定的VisitDirty字段的原因是我在查看子表单是否脏的时候有一段时间的恶魔。可能没有

语法正确,但尝试在下面设置一个表格var但也有错误。甚至

尝试进入控制级别但没有成功。


SET frmClient = Forms!Clients.subformVISITs


以上所有内容都是导致错误的测试的结果...


用户在Visit subfrom中输入新记录并通过
$标记b $ b字段到DateEntered字段,当前系统日期是
如果是新记录则输入



此时,DateEntered字段突出显示。如果用户 - 我 - 然后

点击添加客户端按钮而不是可能/将要发生的保存按钮,我想将记录保存在子表单中,然后使用DoCmd.GoToRecord,acNewRec

a新记录之前,从子表单的

Dateentered字段移到第一个名称字段>

如果创建新记录时光标位于DateEntered字段中

则将当前日期输入到字段中,但错误很快就会显示

,因为没有新的客户编号(自动编号)插入到访问

表clientnum字段中。


猜猜我需要更好地理解访问事件模型等。

使用Access97,client和subformVisit表单分别绑定到

客户端和访问表。

BTW,使用bang(!)和点(。)时有什么区别

ref在

表格中获取表格!客户!subformVisits和Forms!Clients.subformVisit。


提前感谢您的帮助/建议,


Rey

Howdy all.
Appreciate your help with several problems I''m having:

I''m trying to determine if the Visit subform (subformVisits) has a new
record or been changed, i.e. dirty. The form that contains the subform is
named Clients.

I have this code in the Add Client btn:
If Forms!Clients.subformVisits!VisitDirty = True Then
MsgBox "Visit subform is dirty!"
Else
MsgBox "problems. subform not dirty"
End If
But it displays err "application defined or object defined error."

The field VisitDirty is an unbound & not visible field with a True/False
format in the details section of subformVisits. Its code is:

Private Sub VisitDirty_AfterUpdate()
'' to see if the subform is "dirty", i.e. has changed or new record
If Me.Dirty Then
Me.VisitDirty = True
End If

End Sub

The reason for the unbound VisitDirty field is that I was having a devil of
a time trying to check if the subform was dirty. Probably didn''t have the
syntax correct but tried setting a form var below but also had errs. Even
tried going to the control level but no success.

SET frmClient = Forms!Clients.subformVISITs

All the above is as the result of a test that caused an err...

The user enters a new record in the Visit subfrom and has tabbed thru the
fields to the DateEntered field into which the current system date is
entered if a new record.

At this point, the DateEntered field is highlighted. If the user - me - then
clicks on the Add Client button instead of the Save button which could/will
happen, I want to save the record in the subform, then move away from the
Dateentered field of the subform to the first name field before calling for
a new record in the Client form using DoCmd.GoToRecord , , acNewRec

If the cursor is in the DateEntered field when the new record is created
then the current date is entered to the field but an err will soon display
because there is no new client number (autonumber) to insert into the Visit
table clientnum field.

Guess I need to better understand the Access event model among other things.
Using Access97 and both the client and subformVisit forms are bound to the
Clients and Visits table, respectively.

BTW, what is the difference between using the bang (!) and the dot (.) when
referencing a form as in
Forms!Clients!subformVisits and Forms!Clients.subformVisit.

Thanks in advance for your help/suggestions,

Rey

推荐答案



" Rey" <再******** @ cox.net> skrev i melding

新闻:_hWjb.29413

"Rey" <re********@cox.net> skrev i melding
news:_hWjb.29413


gi2.21984@fed1read01 ...
gi2.21984@fed1read01...
你好。
感谢您对我遇到的几个问题的帮助:
Howdy all.
Appreciate your help with several problems I''m having:




在当前事件的子表单中尝试此代码。


Sigurd

Private Sub Form_Current()

Dim rs As Recordset


设置rs = RecordsetClone

如果rs.RecordCount = 0然后

MsgBox没有记录

否则

MsgBox rs.RecordCount& "记录

结束如果


End Sub



Try this code in subform on current event.

Sigurd
Private Sub Form_Current()
Dim rs As Recordset

Set rs = RecordsetClone
If rs.RecordCount = 0 Then
MsgBox "no records"
Else
MsgBox rs.RecordCount & " records"
End If

End Sub


Sigurd&全部,

如果你打开一个记录集来检查记录数,那么你不需要

包括

rs.MoveLast之前检查rs.RecordCount?

Fred Zuckerman

美国加利福尼亚州圣地亚哥

" Sigurd Bruteig" < S - ******** @ online.no>在消息中写道

新闻:Ul ******************* @ news4.e.nsc.no ...
Sigurd & All,
If you open a recordset to check for record count, then don''t you have to
include
rs.MoveLast before checking rs.RecordCount?
Fred Zuckerman
San Diego, CA, USA
"Sigurd Bruteig" <s-********@online.no> wrote in message
news:Ul*******************@news4.e.nsc.no...

Rey <再******** @ cox.net> skrev i melding
新闻:_hWjb.29413

"Rey" <re********@cox.net> skrev i melding
news:_hWjb.29413


这篇关于如何检查子窗体是否脏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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