Results 1 to 4 of 4
  1. #1
    accessgm is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Posts
    10

    DLookUp Alternative in Form Fields - Value needs to be stored in a table.


    I have a main table that contains several text fields where the Display Controls are combo boxes. The selection choices for the combo boxes are from a second table. This main table is the record source for a form. As shown in the image below, when P5 is selected per the drop down, I would like P5Price and P5Description to auto populate with their corresponding values from the second table. I can accomplish this with DLookUp’s as seen in the example, but I need the results stored in the main table for the unique record that is being viewed in the form. Thanks in advance! GM

    Click image for larger version. 

Name:	Picture1.png 
Views:	15 
Size:	32.1 KB 
ID:	35132
    Attached Thumbnails Attached Thumbnails Picture2.gif  

  2. #2
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,002
    In the combo add the two fields you need as hidden columns to the combo row source.

    In the after update event of the combo set the other fields to the hidden values using something like (assuming your combo is called cmbP5, and the bound column is the first column)
    Code:
    Me.P5Price = Me.cmbP5.Column(1)
    Me.P5Description = Me.cmbP5.Column(2)
    Combo column numbering starts at 0 - so the second column is referenced as Column(1) etc...
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    in your combo for P5, also bring through price and description. Assuming you are bringing through an ID, you will have 4 columns

    ID, P5name, Price, Description

    set column widths to

    0,5,0,0

    in the combo afterupdate event put

    me.p5price=p5.column(2)
    me.p5description=p5.column(3)

    not clear on your naming convention so change names to suit

  4. #4
    accessgm is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Posts
    10
    Thank you both for the solutions! Followed as suggested and working as needed!

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

Similar Threads

  1. Alternative to Lookup fields
    By Athar Khan in forum Programming
    Replies: 7
    Last Post: 09-02-2017, 11:53 AM
  2. Replies: 2
    Last Post: 08-24-2017, 11:53 AM
  3. Replies: 14
    Last Post: 05-30-2015, 09:22 PM
  4. Replies: 9
    Last Post: 02-16-2015, 05:54 PM
  5. Dlookup alternative
    By scotty22 in forum Queries
    Replies: 19
    Last Post: 10-26-2011, 06:20 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