Lrn2Code
Registered User.
- Local time
- Today, 15:23
- Joined
- Dec 8, 2008
- Messages
- 56
Here I am again with my problem du jour!
I'm trying to select all records in a table where an educator ID is = to an exact value but the courseid numbers are between two values. I've tried multiple ways to reference the numbers (with and without ", &, and values with () ) and I keep getting a syntax error.
Have searched this site but most of the answers I'm finding relate to date values and that's not what I'm looking for.
If someone could tell me what I'm missing/doing wrong that'd be fantastic. Here's my latest iteration of the code -
strS5 = "Select * from tblTeacher Courses where EducatorID = " & lngThisID & " And courseid => " & 5053000 & " and =< " & 5059000 & ""
Debug.Print (strS5)
Set rst5 = dbs.OpenRecordset(strS5) - This line is where the syntax error happens. Error 3075 missing operator.
If rst5.RecordCount < 1 Then
sql = "insert into data_error_log (errdesc, teachername,suid,posid) values (' Educator has an Alt Prog Teacher role, does not have any associated alt prog classes', '" & tname & "','" & emporg1 & "','" & strPOSID & "')"
Set qd = db.CreateQueryDef("", sql)
qd.Execute
cleandata = False
End If
Variables are declared -
Dim db As DAO.Database
Dim qd As DAO.QueryDef
Dim sql As String
Dim rst2 As DAO.Recordset
Dim rst As DAO.Recordset
Dim rstSPED As DAO.Recordset
Dim dbs As DAO.Database
Dim rst3 As DAO.Recordset
Dim rst4 As DAO.Recordset
Dim rst5 As DAO.Recordset
Dim strS3 As String
Dim strS4 As String
Dim strS5 As String
Dim strConsult As String
strConsult = "Consulting"
Dim strPrimary As String
strPrimary = "Primary"
Dim intHasCourse As Integer
Dim strPOS As String
Dim strPOSID As String
Dim strThisID As Long
Dim strS As String
Dim counter1 As Integer
Dim intLookForAP As Integer
Dim tname As String
Dim sqlText As String
Dim emporg1 As String
Dim lngEdID As Long
Dim lngClassID As Long
Dim dontbuild As Integer
Dim cleandata As Boolean
cleandata = True
Set dbs = CurrentDb
Set db = CurrentDb
Thanks for your time and guidance!
I'm trying to select all records in a table where an educator ID is = to an exact value but the courseid numbers are between two values. I've tried multiple ways to reference the numbers (with and without ", &, and values with () ) and I keep getting a syntax error.
Have searched this site but most of the answers I'm finding relate to date values and that's not what I'm looking for.
If someone could tell me what I'm missing/doing wrong that'd be fantastic. Here's my latest iteration of the code -
strS5 = "Select * from tblTeacher Courses where EducatorID = " & lngThisID & " And courseid => " & 5053000 & " and =< " & 5059000 & ""
Debug.Print (strS5)
Set rst5 = dbs.OpenRecordset(strS5) - This line is where the syntax error happens. Error 3075 missing operator.
If rst5.RecordCount < 1 Then
sql = "insert into data_error_log (errdesc, teachername,suid,posid) values (' Educator has an Alt Prog Teacher role, does not have any associated alt prog classes', '" & tname & "','" & emporg1 & "','" & strPOSID & "')"
Set qd = db.CreateQueryDef("", sql)
qd.Execute
cleandata = False
End If
Variables are declared -
Dim db As DAO.Database
Dim qd As DAO.QueryDef
Dim sql As String
Dim rst2 As DAO.Recordset
Dim rst As DAO.Recordset
Dim rstSPED As DAO.Recordset
Dim dbs As DAO.Database
Dim rst3 As DAO.Recordset
Dim rst4 As DAO.Recordset
Dim rst5 As DAO.Recordset
Dim strS3 As String
Dim strS4 As String
Dim strS5 As String
Dim strConsult As String
strConsult = "Consulting"
Dim strPrimary As String
strPrimary = "Primary"
Dim intHasCourse As Integer
Dim strPOS As String
Dim strPOSID As String
Dim strThisID As Long
Dim strS As String
Dim counter1 As Integer
Dim intLookForAP As Integer
Dim tname As String
Dim sqlText As String
Dim emporg1 As String
Dim lngEdID As Long
Dim lngClassID As Long
Dim dontbuild As Integer
Dim cleandata As Boolean
cleandata = True
Set dbs = CurrentDb
Set db = CurrentDb
Thanks for your time and guidance!