how to combin two tables ??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mostafa moniem
    New Member
    • Apr 2016
    • 18

    how to combin two tables ??

    - i had a database with two tables..
    - each table contain a field named Date
    - i wanna to make a form to search for records by date in the both tables
    - any body could help me ??
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    mostafa moniem:
    Queries are your friend.
    You have a few choices:
    + you can create a query that pulls both tables in and joins on a related field returning records from both tables. Without the join, you'll have a mess on your hands

    + depending on the tables designs you could use an append query to merge the two tables; however, you've not provided enough detail

    -- Your question lacks a bit of detail that would help us to point you in the best direction, such as table design and how or if the tables are related.

    The more clearly you describe your situation the closer we can get you to the goal within a few posts.

    -- If both tables are designed exactly the same, then you potentially have a huge normalization and design problem. Please read: Database Normalization and Table Structures

    -- [Date] is a reserved word and as such really isn't advisable to use for a field name...
    Allen Browne: Problem names and reserved words in Access - Entry Number 982 (as of 20160430)

    -- Please understand, in all but the most complex situations, we do ask that you show your work. This helps us to avoid answering homework type questions and to focus on those posts where our members are really stuck.

    You'll find that very few of our experts will simply provide ready to run code/script without you showing an effort first. Bytes.com has a more "Teaching" approach than a provide the black-box type answer.

    -- Please check your Bytes.com inbox: I sent you a copy of resources a few days ago. In that resource listing is a link to a tutorial. Once you complete that tutorial you'll have a much better grasp on how handle situations such as this... you should read thru the entire document especially the last two links.

    Comment

    • mostafa moniem
      New Member
      • Apr 2016
      • 18

      #3
      - i can't got it ..

      - i could attach the data base to make it ore clear ..
      the two tables (Cairo-CT - Cairo-INV) i need to make a query to make the field (Date) to be common

      - any body could help me ?

      Comment

      • zmbd
        Recognized Expert Moderator Expert
        • Mar 2012
        • 5501

        #4
        Mostafa;
        - i can't got it ..
        This makes no sense.

        - i could attach the data base to make it ore clear ..
        Because most of our Experts and Moderators answer posts from work behind firewalls and/or on secured PCs, attachments are not usually our first option.

        Indeed, most of the time, we do not need the file. Simply providing the information in the post is enough

        See this example: Sum Across Columns in Crosstab
        VBA and SQL can be posted within the thread and it is preferred that such be posted as text within the thread, not as an image or attachment, and formatted using the [CODE/] (required) button (or you can insert [CODE]..[/CODE] tags around the text by hand) as shown in the above link. NOTICE THE DATA TABLES... the [CODE/] format will hold your table formatting... just use spaces and NOT tabs to align the columns.

        i need to make a query to make the field (Date) to be common
        Simply joining on the [date] field may not be enough, as I indicated in my first reply, the tables may need to have more than that in common.

        However, it may be as simple as joining on that field... in the query design, show both tables, link on the [date] field. Because we do not have any details, all I can suggest is to try setting the link between the tables to show all the records from one of the tables and only the related records in the second. Once that is done, drag the fields from each table that show the data you are trying to retrieve in to the grid display. Run the query to see if this works.

        Beyond this basic guide, you simply have not provided enough detail about the tables themselves (refer to the above link for an example for how to do this).

        two tables (Cairo-CT - Cairo-INV)
        The naming of the tables you've provided makes me wonder if you have properly normalized your database.

        - any body could help me ?
        We do ask that you make an effort and when possible show what work you've done. This does several things: it gives us an idea of your knowledge level, it keeps us from rehashing what you've already tried, and finally it shows "sweat equity" on the poster's part

        The tutorial link in the PM I've sent you will walk you thru how to build the core query types that you simply MUST MASTER. These are BASIC skills that every database developer MUST KNOW and UNDERSTAND - hence, why I sent you the PM with the tutorial link and other resources.

        ++ Unless the situation is: very simple, very unusual, or unusually complex - code/sql solutions are not normally just provided on demand please see our FAQ

        Comment

        Working...