Friday, 27 September 2013

Operation must use an updatable query

Operation must use an updatable query

I am having a problem with an update query that is used to update
personnel in a table.The people being updated are personnel which have
deployed however every time I run the update query I get the error
"Operation must use an updatable query". The following code SQL code is
what is in the query
UPDATE [427 Deployed Roster Import] LEFT JOIN Personnel ON ([427 Deployed
Roster Import].[LAST NAME] = Personnel.[Name-Last]) AND ([427 Deployed
Roster Import].[FIRST NAME] = Personnel.[Name-First]) SET [427 Deployed
Roster Import].[LAST NAME] = [Personnel]![Name-Last], [427 Deployed Roster
Import].[FIRST NAME] = [Personnel]![Name-First], [427 Deployed Roster
Import].RANK = [Personnel]![Rank], [427 Deployed Roster Import].[POSITION]
= [Personnel]![Crew Position], [427 Deployed Roster Import].Rotator =
[Personnel]![Rotator Date], [427 Deployed Roster Import].[Exp RETURN DATE]
= [Personnel]![RDD], [427 Deployed Roster Import].LOCATION =
[Personnel]![Gaining Unit];
I have also tried to convert this SQL query into VBA which not only fails
to work but also displays no errors at all. When I add a watch the actual
line of VBA i get a value . The following is the converted VBA:
Private Sub btn489Update_Click()
On Error GoTo btn489Update_Click_Err
strSql = "UPDATE [489 Deployed Roster Import] LEFT JOIN Personnel ON ([489
Deployed Roster Import].[LAST NAME] = Personnel.[Name-Last])" & vbCrLf & _
"AND ([489 Deployed Roster Import].[FIRST NAME] =
Personnel.[Name-First]) SET [489 Deployed Roster Import].[LAST NAME] =
[Personnel]![Name-Last]" & vbCrLf & _
", [489 Deployed Roster Import].[FIRST NAME] =
[Personnel]![Name-First], [489 Deployed Roster Import].RANK =
[Personnel]![Rank]" & vbCrLf & _
", [489 Deployed Roster Import].[POSITION] = [Personnel]![Crew
Position], [489 Deployed Roster Import].Rotator = [Personnel]![Rotator
Date]" & vbCrLf & _
", [489 Deployed Roster Import].[Exp RETURN DATE] = [Personnel]![RDD],
[489 Deployed Roster Import].LOCATION = [Personnel]![Gaining Unit] " &
vbCrLf & _
"WHERE ((([489 Deployed Roster Import].[LAST NAME])<>""""));"
btn489Update_Click_Exit:
Exit Sub
btn489Update_Click_Err:
MsgBox Error$
Resume btn489Update_Click_Exit
End Sub
Any suggestions would be greatly appreciated as I have been working on
this problem all day with no luck. I can provide more information if it is
needed.

No comments:

Post a Comment