Where Condition Error 3075

VSolano

Registered User.
Local time
Today, 14:32
Joined
Feb 21, 2017
Messages
92
I have the following code and it is giving me the missing operator error and I can not figure out how to fix it. Any help will be greatly appreciated.

Code:
Option Compare Database
Option Explicit
Private Sub Form_Open(Cancel As Integer)
Call taskschedule
Me.AllowEdits = False
Dim SQLDataSource As String
Dim AppUser As Integer
 

If TempVars("usersecurity") <> 1 Then
    SQLDataSource = " SELECT * FROM tbtaskschedule WHERE TaskAssignedTo =  & TempVars![SYSID] & "
    
Else
    SQLDataSource = " SELECT * FROM tbtaskschedule"
    
End If
    Me.RecordSource = SQLDataSource
    Me.Requery
End Sub
 
Try concatenating variable reference:

SQLDataSource = "SELECT * FROM tbtaskschedule WHERE TaskAssignedTo = " & TempVars![SYSID]

This expects TaskAssignedTo to be a number.

I don't use TempVars so no idea if syntax is correct because I see two versions used.
 
Thanks

It works
 

Users who are viewing this thread

Back
Top Bottom