Results 1 to 3 of 3
  1. #1
    batowl is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    86

    Automatically Update Field on Subform?

    Hi All,



    I am trying to get a field that exists on a subform called Amendment_Number, the field is also called Amendment_Number, to be automatically updated to the text N/A if a database user chooses an agreement type on the main form as Contract. Here is the code I am using.

    Private Sub Agreement_Type_Change()
    If [Agreement_Type] = "Contract" Then
    Amendment_Number SubForm.[Amendment_Number] = "N/A"
    End If
    End Sub

    I cannot understand why this is not working. Any suggestions? Thank you.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    VBA syntax for referencing subform field is:

    Me.subformname!fieldname

    Me is alias for main form name and can be used because the code is also behind the main form.

    I always give subform container control a name different from the object it holds, like: ctrAmend

    Then
    Me.ctrAmend!Amendment_Number = "N/A"
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    batowl is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    86
    Perfect! Thank you!

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

Similar Threads

  1. Replies: 9
    Last Post: 04-13-2012, 10:10 AM
  2. Replies: 4
    Last Post: 04-18-2011, 07:18 AM
  3. Automatically update field
    By Top Fuel Friday in forum Forms
    Replies: 3
    Last Post: 02-12-2011, 12:14 PM
  4. Update field in table after update on a subform
    By jpkeller55 in forum Queries
    Replies: 3
    Last Post: 09-30-2010, 08:02 PM
  5. Replies: 5
    Last Post: 08-20-2010, 06:40 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