Results 1 to 2 of 2
  1. #1
    zylosan is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    17

    Looking up a record that matches multiple fields to retrieve data for another field.

    I am attempting to create a button on a form that takes data from 2 fields on the form, looks up a matching record, and updates a field in the record the form is linked to.

    I have a base table linked to this form tbl_product_testing_data that stores various information about QA tests.

    I have a form based on tbl_product_testing_data that displays a number of fields
    Test_Number
    Bun_Layer
    Density_Results

    I have a second table called tbl_testing_sets in which test data is stored. It contains the fields
    test_type
    test_result
    bun_test_num
    bun_layer

    I want to click on a button and activate its on_click event at which point I would like its VBA code to
    1. look up a record in the table tbl_testing_sets that matches its bun_test_num = [Test_Number] and bun_layer = [Bun_Layer], and test_type = [constant string of test type].

    2. Transfer the test_result field data from the record that has been looked up to the Density_Results field.

    3. refresh the displayed form.

    This is some example code of what I have so far that works to find a record based on a single field (Tensile_Set) I know this code will not work for what I want to do.

    Dim rst_test_set As DAO.Recordset
    Set rst_test_set = Application.CurrentDb.OpenRecordset("tbl_testing_s ets", dbOpenDynaset)


    rst_test_set.FindFirst "test_set_num = " & Me!Tensile_Set


    Me!Tensile_Strength = rst_test_set!test_result




    Me.Requery

  2. #2
    zylosan is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    17

    Solved.

    This problem has been solved.

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

Similar Threads

  1. Replies: 6
    Last Post: 08-23-2012, 05:06 AM
  2. Replies: 1
    Last Post: 03-09-2012, 07:43 PM
  3. Replies: 1
    Last Post: 05-17-2011, 05:19 AM
  4. Replies: 1
    Last Post: 12-10-2009, 08:41 PM
  5. Replies: 0
    Last Post: 06-03-2009, 10:25 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