Results 1 to 2 of 2
  1. #1
    drsayman is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2011
    Posts
    1

    How to select values from two columns in one field?

    Hello, I have a form (Orders) with a subform (OrderDetails) that have a fields like a Barcode(from tblBarcode), ProductID(tblProducts), ProductName(tblProducts) and etc.



    I want to union Barcode and ProductID fields into one where I can type ProductID.Value or Barcode.Value(if have Barcode) and fill in ProductID.Value in the same field.
    Or union three of them BarCode,ProductID,ProductName if can.
    Here are some more clarification on the task.
    1. I have a tblBarcode with a fields ProductID (text) and Barcode (text).
    2. I have a tblProducts-ProductID (text),ProductName(Text) and etc.
    3. form OrderDetails with a field ProductID where if you enter "barcode" to write ProductID which refers to the barcode, but I want to can enter and ProductID when barcode missing.

    Thank's for a help in advance.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    First, do a SELECT query that joins the two tables.

    Then do a UNION query with fields of the SELECT query. There is no wizard or designer for UNION, must type into the SQL View of query designer. Like:

    SELECT ProductID, ProductID As Criteria, ProductName FROM query
    UNION SELECT ProductID, Barcode, ProductName FROM query;
    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. Combining values of 2 columns into one string
    By LAazsx in forum Programming
    Replies: 1
    Last Post: 11-25-2010, 08:36 PM
  2. Replies: 1
    Last Post: 10-09-2009, 11:52 AM
  3. Replies: 1
    Last Post: 10-01-2009, 06:41 AM
  4. Setting default values in columns
    By crownedzero in forum Programming
    Replies: 0
    Last Post: 06-17-2009, 06:45 AM
  5. Replies: 0
    Last Post: 04-03-2009, 01:15 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