Results 1 to 2 of 2

Thread: ms access - show label if child doesn't exist

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    586

    Smile ms access - show label if child doesn't exist

    Hi,

    i have a parent form with a child subform.

    the forms connect using the personID, and subform displays the person special hobbies.

    some persons don't have any special hobbies, and therefore don't have any records in the personsSpecialHobbies table.

    currently this results in the subform being blanked out.

    Q: how do i display in this situation a label inside the form saying "person doesn't have any special hobbies" (or similar solution).

    Thanks,

  2. #2
    Hyperactive Member Davadvice's Avatar
    Join Date
    Apr 2007
    Location
    Glasgow (Scotland)
    Posts
    440

    Re: ms access - show label if child doesn't exist

    hi,

    I don't use sub forms so am taking a stab in the dark here,

    I would asume that if the sub form is open then you have a form object

    so you may be able to test the Key field using code

    Code:
    dim f as form
    set f = forms("subFromNAme") 
    
    if is null(f.Keyfield ) then 
    lblNothingthere = "No Hobbies"
    endif 
    set f = nothing
    as i said i don't use sub forms so i may be wrong

    Thanks
    David
    This is Blank

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width