See the DB
See the DB
Your first problem is that you are trying to do evaluations and apply expressions in a continuous form. If a control is not bound to the form's recordset it will not know what to do (display). Controls in continuous forms depend on being bound to the recordset in order to understand which record they are supposed to be associated with.
If it is necesary for the user to view historical data (in Continuous form view or Datasheet View) while they create a new record, you will need to employ a Main Form/Subform.
Well what is the solution permission
Are the tables are correct
Do Query 1 is true
I am not sure about the tables because I have not looked at them. As far as a solution, the easiest approach is to create new records using "Single Form" and setting the "Data Entry" property to equal "Yes". A form with these settings would have to be dedicated to creating new records.
Additional forms would then be used for viewing historical data and or editing the existing data.
Yes ItsMe
I have done it already has created a special new form introduction of a new student
But the problem in
1. Function (DCount)
2. Closure of the classroom when a certain number, for example, 40 students per section
The alias you created in your query, "Field" is not available in your table. It is only available in your query. Your domain function needs to reference the query object.
See if you can get that to work for you and retrieve the correct count. Eventualy, you will need to choose an event handler, such as BeforeUpdate, to place your code (after you create more code to evaluate intCount). Right now you can test the code in a click event of a temporary Button control.Code:Dim intCount As Integer intCount = DCount("*", "Query1", "(field = '1')") MsgBox intCount
Thank you Professor ItsMe
But where I put my code in any event
Is it possible to put it in (DB) facility
I am suggesting that you practice with a temporary Button control. You can create a click event handler using the code I provided in post #22. The purpose would be to practice retrieving the data/recordcount and also to verify it is working correctly. The next step will be to incorporate additional code that will evaluate the count of records. It will be appropriate to place your final version of the code in an On Before Update event handler.
Use the new "Single Form" rather than the continuous form.
I have no idea what the one remaing thing is and why it may be a problem.
Paragraph 2
In Post # 21
Closure of the classroom when a certain number, for example, 40 students per section
You will need to add some code to your existing DCount and evaluate the variant. You can continue testing in your click event and then you will want to use your code in the before update event of the FORM
When you use the code in the Before Update event, you will want to uncomment the "Cancel" line so it executes. In other words, remove the apostrophe '
Code:If intCount >= 40 Then msgbox "There is not any more romm for students here." & _ vbcrlf & "Your request will not be processed. Action Cancelled." 'Cancel = True ' This line will cancel an update if used in the before update event End if