Results 1 to 2 of 2
  1. #1
    Farida is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2015
    Posts
    19

    Split form - Update lookup fields

    Hi, i have a split form on a table PROJECTS_DATA. This works fine.
    However i want to add a couple of extra lookup fields in the form that populates the textboxes based on the ID field of PROJECTS_DATA table from another table.
    I have included below code in Form_Load event And ofcourse this populates the additional text box of the form; only during form load.
    I want the same to be triggered such that my additional lookup textboxes are populated, everytime i navigate / click on different records of the datasheet in split form
    Private Sub Form_Load()


    Dim strSQL As String
    Dim rst As DAO.Recordset
    strSQL = "SELECT Projects_Auto_Population.TITLE FROM Projects_Auto_Population WHERE Projects_Auto_Population.[MOC NUMBER] = " & "'" & Me.[MOC NUMBER].Value & "'"
    Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenSnapshot)

    Me.MOC_TITLE.Value = rst!TITLE
    rst.Close
    Set rst = Nothing

    End Sub

    I have tried placing this on many different events of field [MOC NUMBER] , but none worked.
    Please advice how can i achieve this. Thanks.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    The current event of the form fires when the user changes records (and when the form loads). Try your code there.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 1
    Last Post: 10-28-2014, 04:08 PM
  2. Sort Multiple Fields in a Split form
    By NateL in forum Access
    Replies: 3
    Last Post: 05-01-2014, 01:38 PM
  3. Replies: 1
    Last Post: 12-09-2013, 04:23 PM
  4. Lookup Fields in Form
    By nadergirl08 in forum Forms
    Replies: 7
    Last Post: 04-03-2012, 09:01 PM
  5. Replies: 2
    Last Post: 01-01-2012, 09:32 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