Results 1 to 8 of 8
  1. #1
    ibraomer is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Dec 2010
    Posts
    6

    Emply control check

    I have a database for students registration, students pay their fees in installments, and receive a receipt, then I want when I enter the first installment then the receipt number which is below the first installment control can not be null.


    have it here [if the first installment control contains the fees that the student has paid, then the receipt number control must have the receipt number not null]

  2. #2
    ibraomer is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Dec 2010
    Posts
    6

    Emply control check

    Hi, I have made a program to register students, the students pay in installment, and whenever they pay they should receive a receipt. so in the form I have these fields student name, Fees, firstinstallment, receipt number second installment, receipt number ans so on. what I need is when I enter the first installment then the receipt number must not be blank even if I forget to do so I need access to tell me that you can't leave the receipt number field blank since the first installation field is not blank. does this make sense?

  3. #3
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    try something like:
    Code:
    if isnull(me.receipttextbox) then
       msgbox "receipt must be filled in because first installment is filled in."
          exit sub
    end if
    on an event of your choice.

  4. #4
    ibraomer is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Dec 2010
    Posts
    6
    I do appreciate what you did for me. your code works, but I still can leave the Receipt control empty. I want it to be as required but in case of the above field is updated with value. To make it clear I want you to modify the code to be like this: If the previous field which is the First installment is updated and contains values then the below field which is the receipt number must be updated with the receipt number otherwise I can't move the cursor to another field. I hope I am clear now! I am so sorry for my poor English.
    Last edited by ibraomer; 12-22-2010 at 01:04 PM. Reason: spelling mistakes

  5. #5
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    you know one thing that is not mentioned very often when someone asks that data be 'required' is to do it at the table level and trap the error via the form.

    to further this, let me propose this scenario to you:

    I have a table that has a field in it, and I opened the table in design view and marked the 'required' property to yes.

    Now, I create a form from that table and the field is obviously still required. To trap the error that access will automatically throw to you if you try to save or enter the record without filling in data for that field, you can use:
    Code:
    ErrHandler:
       If Err.Number = 3314 Then
          MsgBox "Required fields must be filled in...", vbExclamation
       End If
    try using that method, and the program will automatically required data there. No other code is needed if you know that this is available to you.

  6. #6
    ibraomer is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Dec 2010
    Posts
    6
    Quote Originally Posted by ajetrumpet View Post
    you know one thing that is not mentioned very often when someone asks that data be 'required' is to do it at the table level and trap the error via the form.

    to further this, let me propose this scenario to you:

    I have a table that has a field in it, and I opened the table in design view and marked the 'required' property to yes.

    Now, I create a form from that table and the field is obviously still required. To trap the error that access will automatically throw to you if you try to save or enter the record without filling in data for that field, you can use:
    Code:
    ErrHandler:
       If Err.Number = 3314 Then
          MsgBox "Required fields must be filled in...", vbExclamation
       End If
    try using that method, and the program will automatically required data there. No other code is needed if you know that this is available to you.

    your efforts are appreciated. I opened the table in design view and marked the 'required' property to yes. this makes that field required all time but I want it to be required only if the field 'First installment' contains value. if the student didn't pay then no reason that the field 'receipt number' to be required.

  7. #7
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    sorry ibra. I've really already given you the answer to that. You'll have to figure it out on your own from this point

    if you want to upload your file, someone may be able to look at it and fix it if it doesn't take too much time.

  8. #8
    ibraomer is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Dec 2010
    Posts
    6
    Quote Originally Posted by ssanfu View Post
    Is this close?

    Code:
    Private Sub Form_Current()
       If Me.Check1212 = True Or Me.Check1418 = True Then
          'all are disabled
          Me.cmd_delete.Enabled = False
          Me.Check1234.Enabled = False
          Me.Check111.Enabled = False
          Me.check116.Enabled = False
          Me.cmd_save_record.Enabled = False
          Me.enter_notes.Enabled = False
       Else
          'these are enabled
          Me.cmd_delete.Enabled = True
          Me.cmd_save_record.Enabled = True
          Me.enter_notes.Enabled = True
    
          'now eval Check111  & Check1234
          If Me.Check111 = True And Me.Check1234 = True Then
             Me.Check1234.Enabled = False
             Me.Check111.Enabled = False
             Me.check116.Enabled = False
          Else
             Me.Check1234.Enabled = True
             Me.Check111.Enabled = True
             Me.check116.Enabled = True
          End If
       End If
    End Sub
    Dear I made a program for students registration, the form contains the following fields: ID, Name, Fees, FirstInstallment, FirstReceiptNo, SeondInstallment, SecondReceiptNo.

    Sometimes I forget to enter the receipt Number so that I want the system to force me enter the receipt number whenever the installment is entered. I tried to make this from the Table design view but this makes the field required all the time even if the student didn't pay the first installment. Please help me with the code. I want the code to force enter the receipt number only if the student have paid the installment because when the pays the he should receive a receipt.
    Last edited by ibraomer; 12-23-2010 at 01:20 AM. Reason: spelling mistakes

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Check for no value
    By jgelpi16 in forum Programming
    Replies: 12
    Last Post: 07-29-2010, 02:53 PM
  2. To check or Un-Check all Boxes in a form
    By devcon in forum Forms
    Replies: 7
    Last Post: 05-01-2010, 12:03 AM
  3. Check box
    By nashr1928 in forum Forms
    Replies: 5
    Last Post: 04-21-2010, 02:37 PM
  4. Check Box Value
    By mulefeathers in forum Programming
    Replies: 4
    Last Post: 10-09-2009, 08:31 PM
  5. Sending control to specific control
    By wasim_sono in forum Programming
    Replies: 2
    Last Post: 04-19-2007, 08:19 AM

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