Results 1 to 6 of 6
  1. #1
    oharmsen is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2014
    Posts
    3

    rowsource of a lookup field dependent on fieldvalue in same record in a subform

    I want to create a different rowsource-query for a lookup field (field1) in each record in a subform.


    The rowsource changes dependent on the value in another field (field2) in the same record.
    How can this be done?
    - I tried to change the rowsource-query in an eventmacro when the focus is set to field1, but this ofcourse changes the rowsource for all field1's and makes the allready selected values unvisible.
    - i think i have to include the value of record 'field2' in the rowsource query, but i cannot find a way to include that value in the query
    something like:
    lookup field1 in the subform contains this rowsource
    - SELECT CUSTOMER.Id, CUSTOMER.AGE, CUSTOMER.NAME
    FROM CUSTOMERS
    WHERE (CUSTOMER.AGE= me![field2]);

    me![field2] however does not function

    please HELP !!

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    You are referring to table CUSTOMER and CUSTOMERS -- can't be both. Which is the correct name of the table?

    You also have a syntax error

    ...WHERE (CUSTOMER.AGE= me![field2]);

    try
    .....WHERE (CUSTOMER.AGE=" & me![field2] &");"

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    If form is in datasheet or continuous view and combobox has conditional RowSource with lookup alias, then the situation of values not showing will persist no matter how you set the RowSource.
    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.

  4. #4
    oharmsen is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2014
    Posts
    3
    With other words.... you say there is no solution for this problem?

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Sort of.

    Include the lookup table in the form RecordSource (join type "Include all records from {data table} and only those from {lookup table} that match"). Bind textbox to the alias field from lookup table. Set properties Locked Yes and TabStop No.
    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.

  6. #6
    oharmsen is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2014
    Posts
    3
    Thanks for your help I understand that you understand the situation. However until now i still didn't manage to make it work with your suggestions, the lookup field now sowhow doesn't accept the chosen input, it only accepts when i use the real record-id, not with the alias. I thought maybe i create 2 field, one that shows the list items (from the record-conditional query ( just a narrow dropdown list) and then the chossen value is displayed in another recordfield...... i let you know if it works.

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

Similar Threads

  1. combobox rowsource per row on a subform
    By kowalski in forum Access
    Replies: 2
    Last Post: 12-05-2012, 01:49 AM
  2. Replies: 2
    Last Post: 09-21-2012, 05:42 PM
  3. Replies: 2
    Last Post: 08-02-2012, 01:47 PM
  4. Replies: 6
    Last Post: 05-05-2012, 08:43 AM
  5. Replies: 5
    Last Post: 06-29-2010, 01:24 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