Results 1 to 3 of 3
  1. #1
    mcktigger is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2011
    Posts
    19

    Validate Subfrom Data

    Hi



    This has annoyed me for sometime and was wondering if there is a solution.

    I have a form FrmOrderHeader with a subfrom subFrmOrderLines. On the main form FrmOrderHeader I have a save button which checks if all fields are completed corerctly. This save button also has the following code

    if IsNull(Forms!FrmOrderHeader!FrmOrderLines!Descript ion) Then
    MsgBox "Please enter a description"
    Me![FrmOrderLines].SetFocus
    Me![FrmOrderLines].Form![Description].SetFocus
    end if

    This works if there is no 2nd blank line on the subfrom but because a new row is always created after the first row is entered the record can't be saved since Description will always be blank.

    Is there a way to check the fields on the subform are completed correctly. I don't really like using the BeforeUpdate event on the subform since users can move focus back to the main form.

    Thanks for any help.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Your subform should not be creating a second blank record unless you've got some code running in on exit, after update, on dirty type event. I would look at the code in your subform to find out why that record is being generated and prevent it from happening unless a certain criteria is met.

  3. #3
    mcktigger is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2011
    Posts
    19
    Hi

    Thanks for the reply. There is no code on any of the subform events. I think it is standard for a new record row to be created automatically when you enter data into the first line.

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

Similar Threads

  1. How to validate data using MS Access
    By maniii in forum Import/Export Data
    Replies: 2
    Last Post: 09-01-2011, 07:29 AM
  2. Replies: 1
    Last Post: 08-06-2011, 10:45 PM
  3. Validate on sum of multipule textboxes
    By Deutz in forum Access
    Replies: 4
    Last Post: 06-01-2011, 05:50 PM
  4. Validate Form Field based on Duplicate Data
    By bornfattom23 in forum Forms
    Replies: 3
    Last Post: 11-05-2010, 02:02 PM
  5. Replies: 5
    Last Post: 08-20-2010, 09:10 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