Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28
  1. #16
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    528

    See the DB
    Attached Files Attached Files

  2. #17
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    528
    When users enter a new student shows me an error
    Departments are not calculated
    Click image for larger version. 

Name:	22233333.JPG 
Views:	6 
Size:	97.7 KB 
ID:	15386

  3. #18
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    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.

  4. #19
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Well what is the solution permission
    Are the tables are correct
    Do Query 1 is true

  5. #20
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    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.

  6. #21
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    528
    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

  7. #22
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    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.

    Code:
    Dim intCount As Integer
    intCount = DCount("*", "Query1", "(field = '1')")
    MsgBox intCount
    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.

  8. #23
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Thank you Professor ItsMe
    But where I put my code in any event
    Is it possible to put it in (DB) facility

  9. #24
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    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.

  10. #25
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Yeb, yeb I did
    Thank you all for help
    One thing remains
    Click image for larger version. 

Name:	sda.JPG 
Views:	3 
Size:	10.7 KB 
ID:	15392

  11. #26
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I have no idea what the one remaing thing is and why it may be a problem.

  12. #27
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Paragraph 2
    In Post # 21
    Closure of the classroom when a certain number, for example, 40 students per section

  13. #28
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    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

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Good introduction to programming in Visual Basic?
    By sshepard in forum Programming
    Replies: 1
    Last Post: 09-22-2011, 11:07 AM
  2. Replies: 1
    Last Post: 05-10-2011, 12:06 PM
  3. Introduction and Questions
    By sblanky in forum Access
    Replies: 2
    Last Post: 01-19-2011, 08:12 PM
  4. stop access from auto adding records
    By svcghost in forum Forms
    Replies: 2
    Last Post: 10-21-2010, 05:25 PM
  5. Replies: 2
    Last Post: 11-29-2009, 12:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums