+ Reply to Thread
Results 1 to 2 of 2

How to write the date in a field in a table based on result from a query in vba.

  1. #1
    Registered User
    Join Date
    11-17-2011
    Location
    South Africa
    MS-Off Ver
    Access, Excel 2010
    Posts
    52

    Cool How to write the date in a field in a table based on result from a query in vba.

    Hi all,

    I have a firearm database that lets people know via email that their permits has expired.
    I have a button that when pressed, opens a query (which gets its information from two tables and another query (to get the latest entry)) and a report, then emails that report as pdf to the mail recipient, and then writes the current date in a field called email901 in the query. The query had to be updated to get more accurate results, but now the query is "not updatable" and therefor it can not write the date in the email901 field.

    This is the code:

    Please Login or Register  to view this content.
    The query shows the latest ID from the last course that was booked. So, what I need is to press the button, the query opens, the report is generated and the email is sent, then I want the code to check the ID "MaxOfpremosID" in the query and match the ID "premosID" in the table "tbl_process_premos" and write the date in the field called "email901" of that record.

    This is a complex database with a lot of sensitive information. It is difficult to attach a sample of the database.

    Thank you in advance.

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,176

    Re: How to write the date in a field in a table based on result from a query in vba.

    You have done a lot of code where none was need. A query would have done this without code.
    You could try this method. An update query would set the date using the person ID.
    put it all in a macro for a simple dbl-click event. (or on a form button)

    Update query is the answer.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 03-18-2015, 07:23 PM
  2. Replies: 0
    Last Post: 06-26-2012, 09:06 PM
  3. Replies: 5
    Last Post: 11-07-2011, 06:09 PM
  4. write result into other field
    By andrej in forum Excel General
    Replies: 1
    Last Post: 08-24-2010, 01:39 PM
  5. Table query based on date
    By manny_cb in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-31-2009, 11:03 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1