Starchildren3317
Registered User.
- Local time
- Today, 06:31
- Joined
- Nov 30, 2010
- Messages
- 11
Good Afternoon Community -
I could really use another pair of eyes looking at my sql statement. I have an Access application with a SQL Server backend.
In the following code I am trying to update a table called Results with a value in a text box on the form and certain fields equaling certain values. The Sub kicks off after you update the text field.
Here is the code:
When I try to run I am getting this error:
Run-time error '3075'
Syntax error (missing operator) in query expression...
and then it lists the query. If anyone sees something I am missing or doing wrong I would greatly appreciate the feedback!
Thanks a ton!
I could really use another pair of eyes looking at my sql statement. I have an Access application with a SQL Server backend.
In the following code I am trying to update a table called Results with a value in a text box on the form and certain fields equaling certain values. The Sub kicks off after you update the text field.
Here is the code:
Code:
Private Sub txtAnalysisFilterDate_AfterUpdate()
Dim aStr As String
Const Dust = "Total Dust"
Const Niosh = "NIOSH 0500"
Const Niosh1 = "NIOSH 500"
aStr = "UPDATE Results SET Results.EnteredDate = " & "'" & [txtAnalysisFilterDate] & "'" & "FROM (Results INNER JOIN dbo_GasSamples ON (Results.Test = dbo_GasSamples.Test) "
aStr = aStr & "AND (Results.SampleNumber = dbo_GasSamples.SampleNumber) AND (Results.OrderID = dbo_GasSamples.OrderID)) "
aStr = aStr & "INNER JOIN SampleDetails ON (dbo_GasSamples.OrderID = SampleDetails.OrderID) AND (dbo_GasSamples.SampleNumber = SampleDetails.SampleNumber) "
aStr = aStr & "AND (dbo_GasSamples.Test = SampleDetails.Test) WHERE (((dbo_GasSamples.OrderID)= " & "'" & [Forms]![LibBreathingAir]![OrderID] & "'" & ") "
aStr = aStr & "AND ((dbo_GasSamples.Test)= " & "'" & Dust & "'" & ") AND ((SampleDetails.Method)= " & "'" & Niosh & "'" & " OR (SampleDetails.Method)= " & "'" & Niosh1 & "'" & "));"
DoCmd.RunSQL aStr
End Sub
When I try to run I am getting this error:
Run-time error '3075'
Syntax error (missing operator) in query expression...
and then it lists the query. If anyone sees something I am missing or doing wrong I would greatly appreciate the feedback!
Thanks a ton!