Results 1 to 2 of 2
  1. #1
    paloma.rz is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Posts
    3

    Add a record in a table with autofilling fields

    Hi everyone,
    I'm trying to create a form to add records to a table "X".
    I have a key code to identify every record from another table "Y": I like to autofill certain labels from the table "Y" when I insert the key, add some others with some combo boxes and then click on a button to add.
    I tried with the form.recordsource, but I have two principal problems:
    - obviously, it extends the source to every label, and so combo boxes go on error;


    - when I click on the "add button" it adds none (maybe cause the labels are only in read form?).
    Thank you so much!!

    Below the code:
    Private Sub findKey_AfterUpdate()
    Dim KeyString As String
    KeyString = " Select [Key] from TableY where ([Key] = '" & Me.findKey & "' ) "
    Me.Form01.RecordSource = KeyString
    Me.Form01.Requery
    End Sub

  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,521
    I'm confused, but is this what you're trying to do?

    http://www.baldyweb.com/Autofill.htm
    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: 15
    Last Post: 10-15-2012, 01:47 PM
  2. Replies: 1
    Last Post: 01-25-2012, 06:46 PM
  3. Autofilling when New Record Created from Form
    By SpdRacerX in forum Forms
    Replies: 6
    Last Post: 01-24-2012, 10:24 AM
  4. Different number of fields for each record in a table
    By gbmarlysis in forum Database Design
    Replies: 9
    Last Post: 12-07-2011, 08:52 PM
  5. Replies: 2
    Last Post: 08-05-2010, 12:39 PM

Tags for this Thread

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