Results 1 to 2 of 2
  1. #1
    chrisjack001 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2010
    Posts
    12

    Adding data to another table in database based on condition


    I have 2 tables in a database called “AccountActivity” & “ReqLog” respectively.
    The “AccountActivity” table has 9 columns.
    Columns A = “Account” is Numeric
    Columns B = “BudgetCategory” is Numeric
    Columns C = “Voucher Nbr” is Text
    Columns D = “REF Type” is Text
    Columns E = “Encumbrance Nbr” is Numeric
    Columns F = “Prefix” is Text
    Columns G = “RequisitionNbr” is Numeric
    Columns H = “Trans Date” is Date/Time
    Columns I = “Obj Code Class” is Numeric

    The “ReqLog” table has 6 columns.
    Columns A = “AutoID” is AutoNumber
    Columns B = “Account” is Numeric
    Columns C = “Prefix” is Text
    Columns D = “RequisitionNbr” is Numeric
    Columns E = “Trans Date” is Date/Time
    Columns F = “FormType” is Text

    Based on the following condition when a record is added to the “AccountActivity” table and the “Prefix” & the “RequisitionNbr” fields are NOT NULL, I want to create a code or a system that will search the other table “ReqLog” for the same “Prefix” & “RequisitionNbr” . If missing add that particular missing record from the “AccountActivity” table to the “ReqLog” table with Only the following fields.
    Account
    Prefix
    RequisitionNbr
    Trans Date
    Example if the following recorded added to the “AccountActivity” table has an Account = 12345, BudgetCategory = 2, Voucher Nbr = D99001, REF Type = RS2, Encumbrance Nbr = 2, Prefix = BTT, RequisitionNbr = 135, Trans Date = 8/30/2004 and Obj Code Class = 205 , The code or system will check the “ReqLog” table for Prefix = BTT & RequisitionNbr = 135 and if missing, the record should be added to that table with only the Account field = 12345, Prefix Field = BTT, RequisitionNbr = 135 & Trans Date = 8/30/2004.
    Can you please give me suggestions on how to accomplish this task or create a code. I am new to Databases and Codes. Thanks in advance.

  2. #2
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529

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

Similar Threads

  1. Replies: 1
    Last Post: 05-25-2010, 02:58 PM
  2. Replies: 4
    Last Post: 02-08-2010, 11:17 AM
  3. Update 2 fields based on where condition.
    By Confused in forum Access
    Replies: 2
    Last Post: 11-19-2009, 05:21 PM
  4. Highlighting Report Data Based on a Condition
    By KramerJ in forum Reports
    Replies: 1
    Last Post: 05-29-2009, 10:27 AM
  5. Adding a table cannot enter data
    By tak4 in forum Queries
    Replies: 0
    Last Post: 02-03-2009, 10:04 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