How change value in a table when change value in a form not bound to that table

Posted on 2011-04-22
Last Modified: 2012-05-11
I have a form which is bound to a table, "tblJobScheduleHeader".  On this form is a field named "txtJobN" and the control source for this field is JobN which is a number field.  The form, by default, opens with txtJobN with 99999999 as the data in that field.  When the user changes this number to another number, say 123456, I want the following to happen...

Find, in "tblOutside Purchase", any record with 99999999 in the field JobN and change it to 123456.

How can this be done.  I would like it to happen in an afterupdate event of the field "txtJobN"

Question by:SteveL13
    1 Comment
    LVL 119

    Accepted Solution

    private sub txtJobN_afterupdate()

    currentdb.execute "update [tblOutside Purchase] set JobN=" & me.txtJobN & " where JobN=99999999"

    end sub

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
    In the article entitled Working with Objects – Part 1 (, you learned the basics of working with objects, properties, methods, and events. In Work…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now