Results 1 to 2 of 2
  1. #1
    Tlo is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Jan 2016
    Posts
    41

    Auto Populate Multiple Item Form Based on Records Entered Seperate Unrelated Table

    I have a table (tblCustomers) that contains all basic customer info. I also have a form (frmHoursEntry - created off of tblActualHours2016) that is going to be used by another user to enter actual hours used on a monthly basis for each customer's account. What I need to do is auto populate the form frmHoursEntry with a Customer Name any time a new customer is entered into tblCustomers. For example, when administration enters "John Doe" as a customer into tblCustomers, I need a new record to populate in the form frmHoursEntry for John Doe.



    The reason I need this is because I've created a query that carries a rolling value of hours for each customer. The formula I used is "JanHrs: IIf(IsNull([tblActualHours2016]![Jan]),[tblProperties]![intJanHrs],[tblActualHours2016]![Jan])". In tblCustomers I have budgeted hours for each month, and in tblActualHours2016 (the table behind frmHoursEntry) I will have actual hours for each month. The idea is that no matter how long the customer has been active, I have a 12 month range of hours summing constantly.

    The formula in the query works, but if there is no record in tblActualHours2016 then Access won't go find hours in tblCustomers. What I'm trying to do is eliminate double data entry from the standpoint of entering a customer in tblCustomers and on the form frmHoursEntry.

    Any help is greatly appreciated!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,892
    To create record in another table can use VBA code like (showing examples for number, text, date types):

    CurrentDb.Execute "INSERT INTO tablename(field1, field2, field3) VALUES(" & Me.textbox1 & ", '" & Me.textbox2 & "', #" & Me.textbox3 & "#)"
    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.

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

Similar Threads

  1. Replies: 9
    Last Post: 02-02-2015, 01:03 PM
  2. Replies: 1
    Last Post: 08-05-2014, 12:40 PM
  3. Replies: 5
    Last Post: 01-10-2013, 11:38 AM
  4. Replies: 2
    Last Post: 08-15-2012, 02:21 AM
  5. Replies: 12
    Last Post: 08-30-2011, 03:36 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