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

Limit Data Entry To Three Records

P: n/a
I have two tables:

TblCourse
CourseID
CourseName

TblClass
ClassID
CourseID
ClassDate

Classes are entered in a subform. How do I limit data entry to a max of 3
classes for any course?

Thanks!

Nancy
Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Try putting this code in the subform's Current event:

if Me.NewRecord then
if Me.RecordsetClone.RecordCount > 2 then
MsgBox "Only three entries allowed."
Me.Recordset.MoveFirst
endif
endif

Pavel

Nancy wrote:

I have two tables:

TblCourse
CourseID
CourseName

TblClass
ClassID
CourseID
ClassDate

Classes are entered in a subform. How do I limit data entry to a max of 3
classes for any course?

Thanks!

Nancy

Nov 12 '05 #2

P: n/a
Pavel,

Thanks for responding!

Your code limits data entry to 3 total records. That's not what I want. I need
to limit data entry to 3 classes for any course. Total records could be well
over 100.

Nancy

"Pavel Romashkin" <pa*************@hotmail.com> wrote in message
news:40***************@hotmail.com...
Try putting this code in the subform's Current event:

if Me.NewRecord then
if Me.RecordsetClone.RecordCount > 2 then
MsgBox "Only three entries allowed."
Me.Recordset.MoveFirst
endif
endif

Pavel

Nancy wrote:

I have two tables:

TblCourse
CourseID
CourseName

TblClass
ClassID
CourseID
ClassDate

Classes are entered in a subform. How do I limit data entry to a max of 3
classes for any course?

Thanks!

Nancy

Nov 12 '05 #3

P: n/a
if it is only ever going to be up to three classes then it would be easier
to make the two tables into one with fields like

class
etc...
"Nancy" <nf****@earthlink.net> wrote in message
news:8L******************@newsread2.news.atl.earth link.net...
I have two tables:

TblCourse
CourseID
CourseName

TblClass
ClassID
CourseID
ClassDate

Classes are entered in a subform. How do I limit data entry to a max of 3
classes for any course?

Thanks!

Nancy

---
Please immediately let us know (by phone or return email) if (a) this email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.687 / Virus Database: 448 - Release Date: 16/05/2004
---
Please immediately let us know (by phone or return email) if (a) this email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.687 / Virus Database: 448 - Release Date: 16/05/2004
Nov 12 '05 #4

P: n/a
TC
He presumeably assumed that the subform was displaying the classes for the
course selected in the main form.

TC
"Nancy" <nf****@earthlink.net> wrote in message
news:SW*******************@newsread2.news.atl.eart hlink.net...
Pavel,

Thanks for responding!

Your code limits data entry to 3 total records. That's not what I want. I need to limit data entry to 3 classes for any course. Total records could be well over 100.

Nancy

"Pavel Romashkin" <pa*************@hotmail.com> wrote in message
news:40***************@hotmail.com...
Try putting this code in the subform's Current event:

if Me.NewRecord then
if Me.RecordsetClone.RecordCount > 2 then
MsgBox "Only three entries allowed."
Me.Recordset.MoveFirst
endif
endif

Pavel

Nancy wrote:

I have two tables:

TblCourse
CourseID
CourseName

TblClass
ClassID
CourseID
ClassDate

Classes are entered in a subform. How do I limit data entry to a max of 3 classes for any course?

Thanks!

Nancy


Nov 12 '05 #5

P: n/a
TC is correct. The code I suggested is to be put into the subform module
where you are entering the classes for a given course, where the course
is chosen on the main form and the subform lists the classes for the
given course.
If you have a different design, you may want to use a query to find the
amount of records:

SELECT Count(ClassID) FROM TblClass WHERE CourseID = MyCourseID AND
ClassID = MyClassID

and then use it in any way you want.
Pavel

Nancy wrote:

Pavel,

Thanks for responding!

Your code limits data entry to 3 total records. That's not what I want. I need
to limit data entry to 3 classes for any course. Total records could be well
over 100.

Nancy

"Pavel Romashkin" <pa*************@hotmail.com> wrote in message
news:40***************@hotmail.com...
Try putting this code in the subform's Current event:

if Me.NewRecord then
if Me.RecordsetClone.RecordCount > 2 then
MsgBox "Only three entries allowed."
Me.Recordset.MoveFirst
endif
endif

Pavel

Nancy wrote:

I have two tables:

TblCourse
CourseID
CourseName

TblClass
ClassID
CourseID
ClassDate

Classes are entered in a subform. How do I limit data entry to a max of 3
classes for any course?

Thanks!

Nancy

Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.