Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / November 2007

Tip: Looking for answers? Try searching our database.

Count Field Change Event

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Giles B - 22 May 2007 09:51 GMT
Hi Folks,

Using Access 2003 with XPSP2.

I have designed a form (frmMain) with an embedded sub-form (frmSub).

frmSub contains a number of records that are displayed in continuous form
mode.

frmSub also contains a field (tbxCount) in its form footer that counts up
the number of records displayed in the Detail section (and seems to work ok).

What I want is for the change of the Count field to trigger the Change Event
so that - when the count reaches a given number (say 10) I can change the
AllowAdditions control to stop any additional records being entered.

At the moment all i'm using is a Debug.Print statement in the change event
for the tbxCount field to try and work out how to get the change event to
trigger. (So, it's not a naff piece of VBA stopping this working!!).

I've tried similar Debug.Print "Hello World" in the BeforeUpdate and
AfterUpdate events for this same field.

How do I get this to work? Is there a smarter way of acheiving my result -
to limit the number of records entered in frmSub to a predetermined number?

Thanks for the help.
Brendan Reynolds - 22 May 2007 10:58 GMT
> Hi Folks,
>
[quoted text clipped - 26 lines]
>
> Thanks for the help.

These events are only fired when data is changed interactively, by the user.
I haven't tested this, but I think you should be able to use the
BeforeInsert event of the subform instead. Something like ...

Private Sub Form_BeforeInsert(Cancel As Integer)

   If Me.RecordsetClone.Count >= 10 Then
       Cancel = True
   End If

End Sub

Signature

Brendan Reynolds

Giles B - 22 May 2007 11:03 GMT
Brendan

Thanks for the quick response, I'll give it a try and let you know.

Rgrds

Giles

> > Hi Folks,
> >
[quoted text clipped - 38 lines]
>
> End Sub
Giles B - 22 May 2007 13:04 GMT
Brendan,

Worked great - thanks for the advice.

Giles

> Brendan
>
[quoted text clipped - 46 lines]
> >
> > End Sub
Jaybird - 16 Nov 2007 14:14 GMT
That was awesome, Brendan!  Thank you very much for posting this answer!  It
helped immensely!

Signature

Why are you asking me?  I dont know what Im doing!

Jaybird

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.