Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JOIN not working

Status
Not open for further replies.

merlynsdad

Programmer
Nov 18, 2010
175
US
I want to add fields from one table into another. I'm using a join as follows:
Code:
strSQL = "UPDATE tblTempEvent " _
            & "SELECT tblTempEvent.TalkTime,tblTempEvent.HoldTime,tblTempEvent.WrapTime " _
            & "FROM tblTempEvent " _
            & "INNER JOIN tblTempCallDetail " _
            & "ON (tblTemp_Event.LOCATION = tblTempCallDetail.LOCATION);"
            Debug.Print strSQL
        db.Execute strSQL
I'm getting zeroes in tblTempEvent even though the data is in tblTempCallDetail. Is my SQL wrong, or should I look for something else?

If the square peg won't fit in the round hole, sand off the corners.
 

You want to [tt]UPDATE tblTempEvent [/tt] but you did not state anywhere something like: [tt] SET FieldABC = 123, FieldXYZ = 'Brown'[/tt]
Which fields do you want to update in tblTempEvent table and to WHAT?

Have fun.

---- Andy
 
I want to update TalkTime, HoldTime and WrapTime in tblTempEvent with data from those fields in tblTempCallDetail.

If the square peg won't fit in the round hole, sand off the corners.
 
strSQL = "UPDATE tblTempEvent A " _
& "INNER JOIN tblTempCallDetail B " _
& "ON A.LOCATION = B.LOCATION " _
& "SET A.TalkTime=B.TalkTime,A.HoldTime=B.HoldTime,A.WrapTime=B.WrapTime"
Debug.Print strSQL
db.Execute strSQL

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top