Connecting Tech Pros Worldwide Forums | Help | Site Map

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

campbellwarren@gmail.com
Guest
 
Posts: n/a
#1: Mar 11 '06
Does anyone know how I could limit the number of rows allowed in a MS
Access table... want to limit it to 1.


salad
Guest
 
Posts: n/a
#2: Mar 11 '06

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


campbellwarren@gmail.com wrote:[color=blue]
> Does anyone know how I could limit the number of rows allowed in a MS
> Access table... want to limit it to 1.
>[/color]
From a form, in the OnCurrent event, you could have something like
Me.AllowAdditions = (Me.Recordsetclone.recordcount > 0)

Bob Quintal
Guest
 
Posts: n/a
#3: Mar 12 '06

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


campbellwarren@gmail.com wrote in
news:1142108625.573777.19070@j52g2000cwj.googlegro ups.com:
[color=blue]
> Does anyone know how I could limit the number of rows allowed
> in a MS Access table... want to limit it to 1.
>[/color]
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.
baonks@gmail.com
Guest
 
Posts: n/a
#4: Mar 12 '06

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


use TOP function

David W. Fenton
Guest
 
Posts: n/a
#5: Mar 12 '06

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


Bob Quintal <rquintal@sympatico.ca> wrote in
news:Xns9783CD7517162BQuintal@207.35.177.135:
[color=blue]
> campbellwarren@gmail.com wrote in
> news:1142108625.573777.19070@j52g2000cwj.googlegro ups.com:
>[color=green]
>> Does anyone know how I could limit the number of rows allowed
>> in a MS Access table... want to limit it to 1.
>>[/color]
> Create an autonumbe field. set the table validation property to
> [field]=1, Replace [field] with the actual name of your field.[/color]

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/
David W. Fenton
Guest
 
Posts: n/a
#6: Mar 12 '06

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


"baonks@gmail.com" <baonks@gmail.com> wrote in
news:1142137159.165403.313490@j33g2000cwa.googlegr oups.com:
[color=blue]
> use TOP function[/color]

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/
Bob Quintal
Guest
 
Posts: n/a
#7: Mar 12 '06

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


"David W. Fenton" <XXXusenet@dfenton.com.invalid> wrote in
news:Xns9784B1B1E9BE4f99a49ed1d0c49c5bbb2@127.0.0. 1:
[color=blue]
> Bob Quintal <rquintal@sympatico.ca> wrote in
> news:Xns9783CD7517162BQuintal@207.35.177.135:
>[color=green]
>> campbellwarren@gmail.com wrote in
>> news:1142108625.573777.19070@j52g2000cwj.googlegro ups.com:
>>[color=darkred]
>>> Does anyone know how I could limit the number of rows
>>> allowed in a MS Access table... want to limit it to 1.
>>>[/color]
>> Create an autonumbe field. set the table validation property
>> to [field]=1, Replace [field] with the actual name of your
>> field.[/color]
>
> 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.[/color]

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.
David W. Fenton
Guest
 
Posts: n/a
#8: Mar 13 '06

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


Bob Quintal <rquintal@sympatico.ca> wrote in
news:Xns9784B894673F9BQuintal@207.35.177.135:
[color=blue]
> "David W. Fenton" <XXXusenet@dfenton.com.invalid> wrote in
> news:Xns9784B1B1E9BE4f99a49ed1d0c49c5bbb2@127.0.0. 1:
>[color=green]
>> Bob Quintal <rquintal@sympatico.ca> wrote in
>> news:Xns9783CD7517162BQuintal@207.35.177.135:
>>[color=darkred]
>>> campbellwarren@gmail.com wrote in
>>> news:1142108625.573777.19070@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.[/color]
>>
>> 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.[/color]
>
> How can you set a field validation rule for an autonumber?
> There's no property for that in the design grid. (ACC2000)[/color]

You're right -- my brain fart.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Bob Quintal
Guest
 
Posts: n/a
#9: Mar 13 '06

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


"David W. Fenton" <XXXusenet@dfenton.com.invalid> wrote in
news:Xns9784CF480F900f99a49ed1d0c49c5bbb2@127.0.0. 1:
[color=blue]
> Bob Quintal <rquintal@sympatico.ca> wrote in
> news:Xns9784B894673F9BQuintal@207.35.177.135:
>[color=green]
>> "David W. Fenton" <XXXusenet@dfenton.com.invalid> wrote in
>> news:Xns9784B1B1E9BE4f99a49ed1d0c49c5bbb2@127.0.0. 1:
>>[color=darkred]
>>> Bob Quintal <rquintal@sympatico.ca> wrote in
>>> news:Xns9783CD7517162BQuintal@207.35.177.135:
>>>
>>>> campbellwarren@gmail.com wrote in
>>>> news:1142108625.573777.19070@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[/color][/color][/color]
property[color=blue][color=green][color=darkred]
>>>> 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[/color][/color][/color]
or[color=blue][color=green][color=darkred]
>>> whatever the limit on the number of records you want to[/color][/color][/color]
limit[color=blue][color=green][color=darkred]
>>> it to.[/color]
>>
>> How can you set a field validation rule for an autonumber?
>> There's no property for that in the design grid. (ACC2000)[/color]
>
> You're right -- my brain fart.
>[/color]
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.
David W. Fenton
Guest
 
Posts: n/a
#10: Mar 13 '06

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


Bob Quintal <rquintal@sympatico.ca> wrote in
news:Xns9784DA854EE3ABQuintal@207.35.177.135:
[color=blue]
> "David W. Fenton" <XXXusenet@dfenton.com.invalid> wrote in
> news:Xns9784CF480F900f99a49ed1d0c49c5bbb2@127.0.0. 1:
>[color=green]
>> Bob Quintal <rquintal@sympatico.ca> wrote in
>> news:Xns9784B894673F9BQuintal@207.35.177.135:
>>[color=darkred]
>>> "David W. Fenton" <XXXusenet@dfenton.com.invalid> wrote in
>>> news:Xns9784B1B1E9BE4f99a49ed1d0c49c5bbb2@127.0.0. 1:
>>>
>>>> Bob Quintal <rquintal@sympatico.ca> wrote in
>>>> news:Xns9783CD7517162BQuintal@207.35.177.135:
>>>>
>>>>> campbellwarren@gmail.com wrote in
>>>>> news:1142108625.573777.19070@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[/color][/color]
> property[color=green][color=darkred]
>>>>> 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[/color][/color]
> or[color=green][color=darkred]
>>>> whatever the limit on the number of records you want to[/color][/color]
> limit[color=green][color=darkred]
>>>> it to.
>>>
>>> How can you set a field validation rule for an autonumber?
>>> There's no property for that in the design grid. (ACC2000)[/color]
>>
>> You're right -- my brain fart.
>>[/color]
> 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.[/color]

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/
Closed Thread


Similar Microsoft Access / VBA bytes