472,371 Members | 1,580 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,371 software developers and data experts.

Limit Data Entry To Three Records

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
5 3843
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Randell D. | last post by:
Folks, I have a SELECT that returns with multiple records - It works when I have a LIMIT clause but when I try to include a GROUP BY clause, the select returns nothing (ie no records, no...
1
by: Trent | last post by:
I am in the design phase of a new database and am having a devil of a time with a subform. I have three tables that relate to problem - Suppliers tbl, Customers tbl and a SuppliersCustomers tbl....
9
by: Terry E Dow | last post by:
Howdy, I am having trouble with the objectCategory=group member.Count attribute. I get one of three counts, a number between 1-999, no member (does not contain member property), or 0. Using...
4
by: Melson | last post by:
Hi I've a problem. Can anyone help. I would like to use datagrid for data entry. How can I set the number of rows in the datagrid. And use the datagrid to update the ms sql table. regards...
1
by: NumberCruncher | last post by:
Hi All, I am struggling with setting up my first system of tables, forms,and reports, and could use your help! I am setting up a database to keep track of the production of a produced item. The...
3
by: bosmatthews | last post by:
I have a main form with a subform and a second subform nested to the first subform. The data entry property for all three forms (main, subform and sub-subform) is set to "yes" because I am intending...
1
by: Gurpal | last post by:
I'm getting this error when I test this page. Here is the error: Response object error 'ASP 0251 : 80004005' Response Buffer Limit Exceeded /test/test4.asp, line 0 Execution of the ASP...
20
by: hippomedon | last post by:
Hello everyone, I'm looking for some advice on whether I should break the normalization rule. Normally, I would not consider it, but this seems to be a special case. I have created an...
5
by: grant | last post by:
I'm trying to use a scatter chart to plot level reading for a pump station level sensor. The sensor takes a reading every 4 seconds, and there are 23,000 reading per chart There appears to be...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.