Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2021
    Posts
    13

    Post Updating Fields On An Access Subform

    Hello,



    I have two date fields on a sub form. I'm trying to update the field named txtGLTransDate after I enter a value in the field txtRegTransDate. I'm getting a message that says "invalid outside procedure." How do I correct this error? Here is the code that I wrote to try an achieve what I want to do.

    Private Sub txtRegTransDate_AfterUpdate()


    'Updates the txtGLTransDate to value of txtRegTransDate and
    txtGLTransDate.Value = txtRegTransDate.Value

    End Sub

    Thanks,

    Joel Wiggers

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,555
    Me.nameOfControl = Me.nameOfOtherControl
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    but if you are referencing other forms ,you may need full paths. Esp. for subforms.

    forms!fForm1!txtbox = forms!fForm2!subform.form.txtBox2

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Is there code outside the Private Sub/End Sub block? That's what the error is implying. Try compiling the code.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 2
    Last Post: 11-27-2017, 08:59 PM
  2. Replies: 2
    Last Post: 07-13-2016, 02:19 PM
  3. Replies: 3
    Last Post: 06-25-2015, 12:54 PM
  4. Replies: 1
    Last Post: 11-07-2012, 05:31 PM
  5. Access: Updating Null Fields with values
    By bmaz in forum Queries
    Replies: 2
    Last Post: 10-11-2011, 05:18 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