Results 1 to 3 of 3
  1. #1
    quinnsfpa is offline Novice
    Windows 8 Access 2007
    Join Date
    Nov 2015
    Posts
    5

    How to automatically populate another record when data is entered into a form

    My form contains subforms for referrals and credits. When an acc no is entered into the referrals form I want to automatically update a field on the credits form for that record, eg Acc No 1 has been referred by Acc No 2 so I enter acc no 2 into the referrals subform for Acc No 1. I then want £5.00 to appear on the credits subform for the record belonging to Acc 2. I hope that makes sense!



    Can anyone tell me how to do this please?

    Thanks.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,649
    Could maybe use VBA code to run an SQL UPDATE action. Something like:

    CurrentDb.Execute "UPDATE tablename SET Amount = 5 WHERE AcctNo=" & Me.AcctNo

    Or if you actually need to create a new record, run an INSERT action.

    CurrentDb.Execute "INSERT into tablename(AcctNo, Amount) VALUES(" & Me.AcctNo & ", 5)"

    Without knowing more about table structure and form design, hard to offer specific advice.
    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.

  3. #3
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    The implementation depends on the structure of your data, as well as the structure of your objects. J7's advice should be noted. It is the implementation via the record set level, and definitely will work.

    If all the fields & records are displaying together via forms/subforms - then one may be able implement with VBA that references the controls; such as Me.SubformName.Form!SubformControlName = 5

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

Similar Threads

  1. Replies: 1
    Last Post: 12-03-2014, 06:41 PM
  2. Replies: 11
    Last Post: 02-04-2013, 05:32 PM
  3. Replies: 97
    Last Post: 05-24-2012, 02:10 AM
  4. Automatically entered data
    By helen_baker in forum Forms
    Replies: 1
    Last Post: 03-13-2012, 06:49 PM
  5. Replies: 0
    Last Post: 11-10-2008, 12:32 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