Article View: comp.databases.ms-access
Article #187Re: How can I limit the number of records in a table? (MS Access)
From: Trevor Best
Date: Wed, 06 May 1998 00:00
Date: Wed, 06 May 1998 00:00
44 lines
2143 bytes
2143 bytes
On Mon, 4 May 1998 17:48:05 +0100 in comp.databases.ms-access, Scott
Mordecai <Scott@musicman.demon.co.uk> wrote:
>>Assuming the foreign key in the subforms recordset is called "FK" then:
>>
>>Sub Form_BeforeInsert(Cancel As Integer)
>> If DCount("*","ThisTable","FK = " & Me!FK)>=3 Then
>> Cancel = True
>> Msgbox "Rassssssssssssp!"
>> End If
>>End Sub
>
>Thanks for that, but I'm afraid I have no idea where I should enter it.
>One of the before/after update field options perhaps?
>
>Cheers,
>--
> \|||/ Scott Mordecai
>< o,o > mailto:scott@musicman.demon.co.uk
> \_/
Sub Form_BeforeInsert
^^^^
Clue #1
Sub Form_BeforeInsert
^^^^^^^^^^^^
Clue #2
In the form properties (event properties), select "BeforeInsert", select
"[Event Procedure]" from the drop down list. Now hit the builder button
next to it (the one marked "...").
\|||/
/ \
C o o D
-----------------ooO--u--Ooo-------------------------------
To reply by mail, replace the "nospam" in my address with "trevor",
then replace the "o" in easynot with an "e".
But please DONT cc me in on posts, I read this group as well.
MS Access FAQ now available on my site below.
http://www.trevor.easynet.co.uk/
Roget's Thesaurus rules - ok, all right, very well, you bet, certainly
Technical Details
Message-ID:
<35506df6.477360@news.easynet.co.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<cUehgLAJMNT1Ewmx@musicman.demon.co.uk> <35640a0b.6616746@news.easynet.co.uk> <WG9DUHAFFfT1Ewnt@musicman.demon.co.uk>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1036bc,d87e857d2b30eade X-Google-Attributes: gid1036bc,public X-Google-Thread: ff0ac,d87e857d2b30eade X-Google-Attributes: gidff0ac,public From: nospam@easynot.co.uk (Trevor Best) Subject: Re: How can I limit the number of records in a table? (MS Access) Date: 1998/05/06 Message-ID: <35506df6.477360@news.easynet.co.uk> X-Deja-AN: 350697735 Content-Transfer-Encoding: 7bit References: <cUehgLAJMNT1Ewmx@musicman.demon.co.uk> <35640a0b.6616746@news.easynet.co.uk> <WG9DUHAFFfT1Ewnt@musicman.demon.co.uk> Mime-Version: 1.0 Reply-To: nospam@easynot.co.uk Content-Type: text/plain; charset=us-ascii Organization: Viasys Limited Newsgroups: comp.databases.ms-access,demon.tech.pc