Results 1 to 3 of 3
  1. #1
    ren086 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    1

    Question auto populate a field

    Hi All, I am trying to build a very simple database to be used for a school library. I have built all the tables however I am now stuck when trying to build the final table to record the book lendings. I put the concept simple ... I have 2 tables, a students table and a books table. Both of them have 2 columns each namely student ID and student name while the books table has book id and book name.

    When I come to the lendings table, I would like to have 4 columns. Student ID / Student Name / Book ID / Book Name



    I have set both Student ID and Book ID to be a combobox using looking from their respective tables and till there it is fine.

    I would like to auto populate Student Name and Book Name from the IDs I have chosen from the respective comboboxes. Instead of writing them manually inorder to avoid having mismatched data. Is it possible that someone guide me how to complete this simple task please. Thanks.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    you dont use 4 columns, you want:
    Student ID / Book ID /

    then in a query you join tLending table to both tStudents and tBooks to get the names.

    Make a form, put in a combo box for students. (bound to StudentID()
    and a combo for books, (bound to BookID)
    add a button to 'Lend"
    this runs an append query to add the 2 IDs to the tLend table.
    docmd.Openquery "qaLendBook"

    choose a student,
    choose a book,
    click Lend button.

    this query looks like:
    insert into tLend (StudentID, BookID) values (forms!myForm!cboStudent,
    forms!myForm!cboBook)

    you may also want to add a LendDate field to the tLend table:
    LendDate (default to Date() )
    DateReturn

  3. #3
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You might look at the Database Answers site.

    In the center list, under " 1. Customers", scroll down to "11. Libraries".
    There are 16 Library models available to look at.

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

Similar Threads

  1. Replies: 4
    Last Post: 09-11-2017, 08:42 AM
  2. Replies: 2
    Last Post: 12-20-2016, 08:55 AM
  3. Replies: 7
    Last Post: 08-19-2016, 08:16 AM
  4. Auto Populate Txt Field
    By Andyjones in forum Forms
    Replies: 1
    Last Post: 03-27-2012, 05:53 PM
  5. Replies: 3
    Last Post: 10-03-2011, 02:33 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