Results 1 to 3 of 3
  1. #1
    rpowers18 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    1

    Auto populate field based on entry in another field

    I am trying to populate two fields based on another drop down field. I have amended some code downloaded from this site but am getting an syntax or paratheses error.



    = SELECT([Oracle Codes].[GROUP], [Oracle Codes].[ID]) FROM ([Oracle Codes] WHERE([Oracle Codes].[DESCRIPTION])=([Forms]![Job Entry Form1]![Combo38]));

    This is the code I downloaded:

    SELECT[Suppleir Details].[DetailsId], [Suppleir Details].[Supplier Name] FROM [Suppleir Details] WHERE ((([Suppleir Details].[DetailsId])=[Forms]![Form1]![Combo0]));

    A another note part of the download included this code: SELECT [Suppleir Details].[DetailsId], [Suppleir Details].[Supplier Code] FROM [Suppleir Details];

    When I try the code in red above it returns the DetailsId in the combobox instead of the Supplier Code when it the example db it returns the Supplier Code.

    Any assitance would be appreciated. It has been awhile since I worked in Access and it shows.

    RGP

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Welcome to the forum!


    Set the column widths property to 0 (zero).
    That will hide the [detailsID] column.
    In Access2000, the column widths is on the Format Tab.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    Using a SELECT sql as an expression in ControlSource property won't work. Options:

    1. Include the related table in form RecordSource, join type 'Include all records from {your primary table} ...', bind textboxes to the related fields and set them Locked Yes, Tab Stop No.

    2. Make the combobox RowSource a query that is a join of the related tables and have textboxes reference columns of the combobox

    3. DLookup() function in textbox
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 10
    Last Post: 07-19-2013, 02:05 PM
  2. Replies: 3
    Last Post: 06-12-2013, 08:53 PM
  3. Replies: 7
    Last Post: 11-28-2012, 01:41 PM
  4. Replies: 3
    Last Post: 10-03-2011, 02:33 PM
  5. Replies: 3
    Last Post: 10-05-2009, 07:22 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