BTW,使用bang(!)和点(。)时有什么区别 ref在 表格中获取表格!客户!subformVisits和Forms!Clients.subformVisit。 提前感谢您的帮助/建议, ReyHowdy all.Appreciate your help with several problems I''m having:I''m trying to determine if the Visit subform (subformVisits) has a newrecord or been changed, i.e. dirty. The form that contains the subform isnamed Clients.I have this code in the Add Client btn:If Forms!Clients.subformVisits!VisitDirty = True ThenMsgBox "Visit subform is dirty!"ElseMsgBox "problems. subform not dirty"End IfBut it displays err "application defined or object defined error."The field VisitDirty is an unbound & not visible field with a True/Falseformat 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 recordIf Me.Dirty ThenMe.VisitDirty = TrueEnd IfEnd SubThe reason for the unbound VisitDirty field is that I was having a devil ofa time trying to check if the subform was dirty. Probably didn''t have thesyntax correct but tried setting a form var below but also had errs. Eventried going to the control level but no success.SET frmClient = Forms!Clients.subformVISITsAll 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 thefields to the DateEntered field into which the current system date isentered if a new record.At this point, the DateEntered field is highlighted. If the user - me - thenclicks on the Add Client button instead of the Save button which could/willhappen, I want to save the record in the subform, then move away from theDateentered field of the subform to the first name field before calling fora new record in the Client form using DoCmd.GoToRecord , , acNewRecIf the cursor is in the DateEntered field when the new record is createdthen the current date is entered to the field but an err will soon displaybecause there is no new client number (autonumber) to insert into the Visittable 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 theClients and Visits table, respectively.BTW, what is the difference between using the bang (!) and the dot (.) whenreferencing a form as inForms!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 meldingnews:_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 SubTry this code in subform on current event.SigurdPrivate Sub Form_Current()Dim rs As RecordsetSet rs = RecordsetCloneIf rs.RecordCount = 0 ThenMsgBox "no records"ElseMsgBox rs.RecordCount & " records"End IfEnd 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 toincluders.MoveLast before checking rs.RecordCount?Fred ZuckermanSan Diego, CA, USA"Sigurd Bruteig" <s-********@online.no> wrote in messagenews:Ul*******************@news4.e.nsc.no... Rey <再******** @ cox.net> skrev i melding 新闻:_hWjb.29413 "Rey" <re********@cox.net> skrev i melding news:_hWjb.29413 这篇关于如何检查子窗体是否脏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-01 15:27