Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8

Thread: multiple tables

  1. #1
    Regular Coder
    Join Date
    May 2005
    Posts
    215
    Thanks
    14
    Thanked 0 Times in 0 Posts

    multiple tables

    Hello all. I was just wondering whether it is possible to have data from 2 differrent database tables in the same form table, or do I need to create another form table?

    Thanks,

    Parallon

  • #2
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Can you explain in more detail? I don't quite understand.

    Thanks,

  • #3
    Regular Coder
    Join Date
    May 2005
    Posts
    215
    Thanks
    14
    Thanked 0 Times in 0 Posts
    Well, the program that I am working on generates a report which has a section called 'Estimates'. Well in this section, there is a list of Equipment with data pertaining to each piece of equipment, i.e. description, type, cost, etc. (All from the same table)... I am trying to add one more bit of information, but this info is coming from a different table in the database. I was just wondering if it is possible to include that data in the same row as the other relevant information? I would post the code, but there are about 820 lines.

    Thanks,

    Parallon

  • #4
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Do these 2 tables relate so you could use a join? What DBMS are you using?

  • #5
    Regular Coder
    Join Date
    May 2005
    Posts
    215
    Thanks
    14
    Thanked 0 Times in 0 Posts
    I really appreciate your effort, but the easiest thing that I think that I could do is to attach the file. BTW, this is a SQL database. What I am trying to do is use the field "Room" from a table called 'Equipment', and associate it to the appropriate equipment. The other fields in this section are coming from a table called 'WOtools'. I have created a space where I need the data on line 427. I am not asking for you to do it for me, but if you could just point me in the right direction.

    Thanks,

    Parallon
    Attached Files Attached Files

  • #6
    Regular Coder
    Join Date
    May 2005
    Posts
    215
    Thanks
    14
    Thanked 0 Times in 0 Posts
    Ok, here is the portion getting some of the information:

    Code:
    sSQL = "SELECT * FROM WOTools WHERE KeyNum = '" & wonum & "' AND Estimate <> 0 ORDER BY Equipment"
    Set rsTool = conn.Execute(sSQL)
    What I need also is to get the record from Equipment.Room. Both the Equipment and WOTools tables have a field called Equipment. Could I just use a LEFT JOIN to get this information also?

    Thanks,

    Parallon

  • #7
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Depends what kind of matches you need. Either INNER join or a LEFT join. Heres an article on joins:
    http://www.w3schools.com/sql/sql_join.asp

    Let us know how it goes.

    Good luck;

  • #8
    Regular Coder
    Join Date
    May 2005
    Posts
    215
    Thanks
    14
    Thanked 0 Times in 0 Posts
    Thank you for your effort. I finally got it with the following method:

    Code:
    sSQL = "SELECT WOTools.*, Equipment.Room FROM WOTools LEFT JOIN Equipment ON WOTools.Equipment = Equipment.Equipment WHERE KeyNum = '" & wonum & "' AND Estimate <> 0 ORDER BY Room"
    Once again, thank you all.

    Parallon


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •