Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2002

    Exclamation Unanswered: Having a problem Inserting and relating to multiple tables.

    the main info is in HBC_zImport which was imported from access in raw form. I broke that tbl into 2 tbl's, 1 for Alpha and the other tbl for Numerical violations. these 2 tbl's had a field that is 3 characters long to combine into one to form a violation. which is already six characters long in the HBC_zImport tbl.

    In the HBC_violation_boiler_Inspection_Link, the fields are alpha...ID, Num...ID and Boiler_Inspection_ID. I want to relate this current tbl with the data in HBC_zImport that has the raw data of violations. So, basically what i'm trying to do is relate the violations to the boiler_inspection_ID.
    If you need more clarification please email me!!!!!!!!!

    strSQL = "Select Violations from HBC_zImport"
    set rs1 = objConn.Execute(strSQL)

    strSQL = "Select * from HBC_Alpha_Violation_CodeDef"
    set rs2 = objConn.Execute(strSQL)

    strSQL = "Select * from HBC_Num_Violation_CodeDef"
    set rs3 = objConn.Execute(strSQL)

    strSQL = "Select * from HBC_Boiler_Inspection"
    set rs4 = objCOnn.Execute(strSQL)

    Do While NOT rs1.EOF

    Do While NOT rs2.EOF

    Do While NOT rs3.EOF

    Do While NOT rs4.EOF

    strSQL = "Insert into HBC_Violation_Boiler_Inspection_Link (Alpha_Violation_CodeDef_ID, Num_Violation_CodeDef_ID, Boiler_Inspection_ID) "
    strSQL = strSQL & VALUES ('" & replace(rs2("ID"), "'", "''") & "', '" & replace(rs3("ID"), "'", "''") & "', '"replace(rs4("ID"); "

  2. #2
    Join Date
    Feb 2003
    @ home

    Re: Having a problem Inserting and relating to multiple tables.

    You get an error messange or you dont get all the values that you whant?

    Paulo Gonçalves

  3. #3
    Join Date
    Feb 2003

    Re: Having a problem Inserting and relating to multiple tables.

    Remove the semi colon ( ; ) from the sql statement where U do the insert .

    Hope that helps

    Kiran Math

Posting Permissions

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