Run time error '3075' Syntax error (missing operator)

candyA25

New member
Local time
Today, 17:21
Joined
Jun 26, 2013
Messages
9
Can someone tell me why I'm getting a run-time error on the line below? I suspect it has something to do with the SQL query I have defined in the variable?

Line causing run-time error:
Code:
Set rs = db.OpenRecordset(MedSelectQuery, dbOpenDynaset)

Content of MedSelectQuery variable:

Code:
strLocalBE = Left(CurrentProject.FullName, Len(CurrentProject.FullName) - 6) & "_be.accdb"

MedSelectQuery = "SELECT * " & _
"FROM [C:\Database.accdb].tblMedData AS tblLaptop 
INNER JOIN [I:\Database_be.accdb].tblMedData " & _
"AS tblServer ON tblLaptop.InvNo = tblServer.InvNo " & _
"WHERE ((tblLaptop.DateChanged)>=(" & FileCreatedDate & "))
And ((tblServer.DateChanged)>=(" & FileCreatedDate & ")) And " & _
"(((tblLaptop.DetailsChanged)=True And (tblServer.DetailsChanged)=True 
And (tblLaptop.Ratio)<>tblServer!Ratio)) " & _
"Or (((tblLaptop.Duration)<>tblServer!Duration)) 
Or (((tblLaptop.Withdrawal)<>tblServer!Withdrawal)) 
Or (((tblLaptop.WaterOrInject)<>tblServer!WaterOrInject))" & _
"Or (((tblLaptop.ChangedBy)<>tblServer!ChangedBy)) 
Or (((tblLaptop.Deleted)<>tblServer!Deleted));"

FileCreatedDate variable code:
Code:
Dim fso, f As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(strLocalBE)
Dim FileCreatedDate As Date
If f <> "" Then
    FileCreatedDate = f.DateCreated
Else
     MsgBox "Missing data in path file -- unable to synchronize.  Contact IS.", vbCritical, "Synchronization Failed"
            Me.Label0.Caption = "Synchronization Failed -- Missing File Paths.  Contact IS!"
     Exit Sub
End If
    
Set fso = Nothing
Set f = Nothing

..............
         
FileCreatedDate = FileDateTime(strLocalBE)
 
Date values generally need to be surrounded by # delimiters in Access.
 
"WHERE ((tblLaptop.DateChanged)>=(#" & FileCreatedDate & "#))
 

Users who are viewing this thread

Back
Top Bottom