By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,022 Members | 1,401 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,022 IT Pros & Developers. It's quick & easy.

set a limit to the number of rows allowed in a table

P: n/a
Does anyone know how I could limit the number of rows allowed in a MS
Access table... want to limit it to 1.

Mar 11 '06 #1
Share this Question
Share on Google+
9 Replies


P: n/a
ca************@gmail.com wrote:
Does anyone know how I could limit the number of rows allowed in a MS
Access table... want to limit it to 1.

From a form, in the OnCurrent event, you could have something like
Me.AllowAdditions = (Me.Recordsetclone.recordcount > 0)

Mar 11 '06 #2

P: n/a
ca************@gmail.com wrote in
news:11*********************@j52g2000cwj.googlegro ups.com:
Does anyone know how I could limit the number of rows allowed
in a MS Access table... want to limit it to 1.

Create an autonumbe field. set the table validation property to
[field]=1, Replace [field] with the actual name of your field.
--
Bob Quintal

PA is y I've altered my email address.
Mar 12 '06 #3

P: n/a
use TOP function

Mar 12 '06 #4

P: n/a
Bob Quintal <rq******@sympatico.ca> wrote in
news:Xn**********************@207.35.177.135:
ca************@gmail.com wrote in
news:11*********************@j52g2000cwj.googlegro ups.com:
Does anyone know how I could limit the number of rows allowed
in a MS Access table... want to limit it to 1.

Create an autonumbe field. set the table validation property to
[field]=1, Replace [field] with the actual name of your field.


I wouldn't use a table-level validation rule, but a field-level rule
on the Autonumber field, and make it <=10 or whatever the limit on
the number of records you want to limit it to.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Mar 12 '06 #5

P: n/a
"ba****@gmail.com" <ba****@gmail.com> wrote in
news:11**********************@j33g2000cwa.googlegr oups.com:
use TOP function


That will work in SQL, but has nothing to do with the original
question, which is about limiting the number of rows that can be
added to a table.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Mar 12 '06 #6

P: n/a
"David W. Fenton" <XX*******@dfenton.com.invalid> wrote in
news:Xn**********************************@127.0.0. 1:
Bob Quintal <rq******@sympatico.ca> wrote in
news:Xn**********************@207.35.177.135:
ca************@gmail.com wrote in
news:11*********************@j52g2000cwj.googlegro ups.com:
Does anyone know how I could limit the number of rows
allowed in a MS Access table... want to limit it to 1.

Create an autonumbe field. set the table validation property
to [field]=1, Replace [field] with the actual name of your
field.


I wouldn't use a table-level validation rule, but a
field-level rule on the Autonumber field, and make it <=10 or
whatever the limit on the number of records you want to limit
it to.


How can you set a field validation rule for an autonumber?
There's no property for that in the design grid. (ACC2000)
--
Bob Quintal

PA is y I've altered my email address.
Mar 12 '06 #7

P: n/a
Bob Quintal <rq******@sympatico.ca> wrote in
news:Xn**********************@207.35.177.135:
"David W. Fenton" <XX*******@dfenton.com.invalid> wrote in
news:Xn**********************************@127.0.0. 1:
Bob Quintal <rq******@sympatico.ca> wrote in
news:Xn**********************@207.35.177.135:
ca************@gmail.com wrote in
news:11*********************@j52g2000cwj.googlegro ups.com:

Does anyone know how I could limit the number of rows
allowed in a MS Access table... want to limit it to 1.

Create an autonumbe field. set the table validation property
to [field]=1, Replace [field] with the actual name of your
field.


I wouldn't use a table-level validation rule, but a
field-level rule on the Autonumber field, and make it <=10 or
whatever the limit on the number of records you want to limit
it to.


How can you set a field validation rule for an autonumber?
There's no property for that in the design grid. (ACC2000)


You're right -- my brain fart.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Mar 13 '06 #8

P: n/a
"David W. Fenton" <XX*******@dfenton.com.invalid> wrote in
news:Xn**********************************@127.0.0. 1:
Bob Quintal <rq******@sympatico.ca> wrote in
news:Xn**********************@207.35.177.135:
"David W. Fenton" <XX*******@dfenton.com.invalid> wrote in
news:Xn**********************************@127.0.0. 1:
Bob Quintal <rq******@sympatico.ca> wrote in
news:Xn**********************@207.35.177.135:

ca************@gmail.com wrote in
news:11*********************@j52g2000cwj.googlegro ups.com:

> Does anyone know how I could limit the number of rows
> allowed in a MS Access table... want to limit it to 1.
>
Create an autonumbe field. set the table validation property to [field]=1, Replace [field] with the actual name of your
field.

I wouldn't use a table-level validation rule, but a
field-level rule on the Autonumber field, and make it <=10 or whatever the limit on the number of records you want to limit it to.


How can you set a field validation rule for an autonumber?
There's no property for that in the design grid. (ACC2000)


You're right -- my brain fart.

Actually, after thinking about it, you don't need an autonumber,
just an int. set the default value to 1, the primary key to the
field, and the validation rule to allow only the one number.

--
Bob Quintal

PA is y I've altered my email address.
Mar 13 '06 #9

P: n/a
Bob Quintal <rq******@sympatico.ca> wrote in
news:Xn**********************@207.35.177.135:
"David W. Fenton" <XX*******@dfenton.com.invalid> wrote in
news:Xn**********************************@127.0.0. 1:
Bob Quintal <rq******@sympatico.ca> wrote in
news:Xn**********************@207.35.177.135:
"David W. Fenton" <XX*******@dfenton.com.invalid> wrote in
news:Xn**********************************@127.0.0. 1:

Bob Quintal <rq******@sympatico.ca> wrote in
news:Xn**********************@207.35.177.135:

> ca************@gmail.com wrote in
> news:11*********************@j52g2000cwj.googlegro ups.com:
>
>> Does anyone know how I could limit the number of rows
>> allowed in a MS Access table... want to limit it to 1.
>>
> Create an autonumbe field. set the table validation property> to [field]=1, Replace [field] with the actual name of your
> field.

I wouldn't use a table-level validation rule, but a
field-level rule on the Autonumber field, and make it <=10 or whatever the limit on the number of records you want to limit it to.

How can you set a field validation rule for an autonumber?
There's no property for that in the design grid. (ACC2000)


You're right -- my brain fart.

Actually, after thinking about it, you don't need an autonumber,
just an int. set the default value to 1, the primary key to the
field, and the validation rule to allow only the one number.


Well, that works for a single-record table, but fails for any other
number of records.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Mar 13 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.