Results 1 to 2 of 2
  1. #1
    nkenney is offline Advanced Beginner
    Windows 2K Access 2007
    Join Date
    Mar 2009
    Posts
    40

    Question Accessing subform fields

    Hi!



    I have a form with a subform. I have a Delete Customer push button. I do not want to delete a customer unless all of the records in the subform have been deleted first (do not want to leave any orphans). I want to access a field in the subform. How do I go about doing this?

    Thanks!

  2. #2
    nkenney is offline Advanced Beginner
    Windows 2K Access 2007
    Join Date
    Mar 2009
    Posts
    40

    Never mind I figured it out. Thanks!

    Here is the code if you are interested:

    Private Sub Delete_Customer_Click()
    On Error GoTo Err_Delete_Record_Click
    With Me![Parts Subform].Form

    ' Check the RecordCount of the Subform.
    If .RecordsetClone.RecordCount > 0 Then

    ' send out errmessage.
    MsgBox ("Customers can not be deleted until all Parts are deleted")
    Resume Exit_Delete_Record_Click

    End If
    End With
    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
    Exit_Delete_Record_Click:
    Exit Sub
    Err_Delete_Record_Click:
    MsgBox Err.Description
    Resume Exit_Delete_Record_Click

    End Sub

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

Similar Threads

  1. Accessing my inventory remotely
    By Steven in forum Access
    Replies: 2
    Last Post: 02-27-2010, 11:56 AM
  2. Multiple users accessing same database
    By 4ACE in forum Access
    Replies: 0
    Last Post: 02-28-2008, 03:10 PM
  3. Replies: 0
    Last Post: 05-24-2006, 09:26 AM
  4. Replies: 1
    Last Post: 12-10-2005, 04:52 PM
  5. Subform in a Subform and relationships
    By St3ph3n in forum Database Design
    Replies: 3
    Last Post: 12-06-2005, 06:34 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