473,385 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Over Flow Error and Run-time Error '3075':

9
I'm having issues with Access 2010, the interface includes the following input options:Last Name, First Name, SSN, and Birth date.

Access was working great since 2012 and all of a sudden we are getting issues since the 21 of January 2015, here are the following errors:

1. Overflow
2. Run-time Error'3075':
Syntax error in query expression 'LastNameLike'*Akers*' AND FirstName Like'*Mike*'AND SSN Like'*100101001*'; DOB Like#4/24/1982#'.

I used the debug tool and it takes me to Me.Referral.Form.Filter = filterstr

Here is the section of the Code that the debugger highlighted:

Expand|Select|Wrap|Line Numbers
  1. Private Sub filters()
  2. Dim filterstr As String
  3. Dim filterlast As String
  4. Dim filterfirst As String
  5. Dim filterssn As String
  6. Dim filterdob As String
  7.  
  8. filterlast = IIf(IsNull(LastName) = False, "LastName Like '*" & Me.LastName & "*'", " ")
  9. filterfirst = IIf(IsNull(FirstName) = False, "FirstName Like '*" & Me.FirstName & "*'", " ")
  10. filterssn = IIf(IsNull(SSN) = False, "SSN Like '*" & Me.SSN & "*'", " ")
  11. filterdob = IIf(IsNull(BirthDate) = False, "DOB Like #" & Me.BirthDate & "#", " ")
  12.  
  13. 'MsgBox Len(filterdob)
  14.  
  15. If Len(filterlast) > 2 And Len(filterfirst) < 2 And Len(filterssn) < 2 And Len(filterdob) < 2 Then
  16.     filterstr = filterlast
  17.  
  18. ElseIf Len(filterlast) > 2 And Len(filterfirst) > 2 And Len(filterssn) < 2 And Len(filterdob) < 2 Then
  19.     filterstr = filterlast & " AND " & filterfirst
  20.  
  21. ElseIf Len(filterlast) > 2 And Len(filterfirst) > 2 And Len(filterssn) > 2 And Len(filterdob) < 2 Then
  22.     filterstr = filterlast & " AND " & filterfirst & " AND " & filterssn
  23.  
  24. ElseIf Len(filterlast) > 2 And Len(filterfirst) > 2 And Len(filterssn) > 2 And Len(filterdob) > 2 Then
  25.     filterstr = filterlast & " AND " & filterfirst & " AND " & filterssn & ";" & filterdob
  26.  
  27.  
  28. ElseIf Len(filterlast) > 2 And Len(filterfirst) < 2 And Len(filterssn) > 2 And Len(filterdob) < 2 Then
  29.     filterstr = filterlast & " AND " & filterssn
  30.  
  31. ElseIf Len(filterlast) < 2 And Len(filterfirst) > 2 And Len(filterssn) > 2 And Len(filterdob) > 2 Then
  32.     filterstr = filterfirst & " AND " & filterssn & " AND " & filterdob
  33.  
  34. ElseIf Len(filterlast) < 2 And Len(filterfirst) < 2 And Len(filterssn) > 2 And Len(filterdob) > 2 Then
  35.     filterstr = filterssn & " AND " & filterdob
  36.  
  37. ElseIf Len(filterlast) < 2 And Len(filterfirst) < 2 And Len(filterssn) < 2 And Len(filterdob) > 2 Then
  38.     filterstr = filterdob
  39.  
  40. End If
  41. Me.Referral.Form.Filter = filterstr
  42. Me.Referral.Form.FilterOn = True
  43. End Sub
Jan 26 '15 #1
18 1332
W4FF
9
Debugger is highlighting the following in bold:

Expand|Select|Wrap|Line Numbers
  1. End If
  2. Me.Referral.Form.Filter = filterstr
  3. Me.Referral.Form.FilterOn = True
  4. End Sub
Jan 26 '15 #2
Stewart Ross
2,545 Expert Mod 2GB
Your problem is at line 25 in the segment above, where a semicolon has been put in place of an AND:

filterstr = filterlast & " AND " & filterfirst & " AND " & filterssn & ";" & filterdob

Replace with

filterstr = filterlast & " AND " & filterfirst & " AND " & filterssn & " AND " & filterdob

The syntax error message is absolutely accurate - you will see the semicolon just before the DOB in your original post. As the filter string is in error all the other errors you are getting should disappear when you fix the cause listed.

-Stewart
Jan 26 '15 #3
W4FF
9
I did what you ask and now I get Run-time error Syntax error (missing operator)
Jan 26 '15 #4
W4FF
9
Here is the entire code just in case I'm missing something:

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Private Sub BirthDate_AfterUpdate()
  3. filters
  4. End Sub
  5.  
  6. Private Sub Closeform_Click()
  7. MsgBox ("Exiting Intake Portal. Click on OK")
  8. DoCmd.Quit
  9. End Sub
  10.  
  11. Private Sub Command47_Click()
  12. Me.Referral.Form.FilterOn = False
  13. LastName = Null
  14. FirstName = Null
  15. SSN = Null
  16. DOB = Null
  17. End Sub
  18.  
  19. Private Sub createref_Click()
  20. On Error GoTo Err_createref_Click
  21.  
  22.     Dim stDocName As String
  23.     Dim stLinkCriteria As String
  24.     Dim args As String
  25.     Dim sqlstring As String
  26.     Dim sqlstring2 As Variant
  27.     Dim temprecord As Recordset
  28.     Dim intRow As Integer
  29.  
  30.  
  31.     notfound = 0
  32.     intRow = 0
  33.     sqlstring = "SELECT LASTNAME & '|' & FIRSTNAME & '|' , referralid FROM REFERRAL order by referralid"
  34.     Set temprecord = CurrentDb.OpenRecordset(sqlstring, dbOpenDynaset, dbSeeChanges)
  35.     args = IIf(IsNull(LastName), "", LastName) & "|"
  36.     args = args & IIf(IsNull(FirstName), "", FirstName) & "|"
  37.  
  38.  
  39.     If temprecord.EOF = True Then
  40.         stDocName = "F_ADD"
  41.         args = args & IIf(IsNull(SSN), "", SSN) & "|"
  42.         args = args & IIf(IsNull(BirthDate), "", BirthDate) & "|"
  43.  
  44.         DoCmd.OpenForm stDocName, , , , acFormAdd, , args
  45.     Else
  46.  
  47.          temprecord.MoveLast
  48.          getrecord = temprecord.RecordCount
  49.          sqlstring2 = temprecord.GetRows(getrecord)
  50.          While notfound = 0
  51.  
  52.              If (intRow - getrecord) = 0 Then
  53.                 notfound = -1
  54.                 stDocName = "F_ADD"
  55.                 args = args & IIf(IsNull(SSN), "", SSN) & "|"
  56.                 args = args & IIf(IsNull(BirthDate), "", BirthDate) & "|"
  57.                 DoCmd.OpenForm stDocName, , , , acFormAdd, , args
  58.  
  59.     '        ElseIf args = sqlstring2(0, intRow) Then
  60.     '            notfound = -1
  61.     '            stDocName = "F_EDIT"
  62.     '            DoCmd.OpenForm stDocName, , "ReferralID = " & sqlstring2(1, intRow), "ReferralID = " & sqlstring2(1, intRow)
  63.              End If
  64.              intRow = intRow + 1
  65.         Wend
  66.     End If
  67.  
  68.  
  69.  
  70.  
  71. Exit_createref_Click:
  72.     Exit Sub
  73.  
  74. Err_createref_Click:
  75.     MsgBox Err.Description
  76.     Resume Exit_createref_Click
  77.  
  78.  
  79. End Sub
  80.  
  81. Private Sub FirstName_AfterUpdate()
  82. filters
  83. End Sub
  84.  
  85.  
  86.  
  87. Private Sub Form_DblClick(Cancel As Integer)
  88. MsgBox "Please single click. Do not double click"
  89. DoCmd.CancelEvent
  90. End Sub
  91.  
  92. Private Sub Form_Load()
  93.     Dim stDocName As String
  94.     Dim stLinkCriteria As String
  95.     Dim args As String
  96.     Dim sqlstring As String
  97.     Dim sqlstring2 As Variant
  98.     Dim temprecord As Recordset
  99.     Dim intRow As Integer
  100.  
  101. '    DoCmd.SetWarnings False
  102.  '   notfound = 0
  103.   '  intRow = 0
  104.    ' lookup = "SELECT * FROM UPDATETHERAPISTNEED"
  105.    ' Set temprecord = CurrentDb.OpenRecordset(lookup)
  106.  
  107.  
  108.     'If temprecord.BOF <> temprecord.EOF Then
  109.     '    sqlstring2 = temprecord.GetRows(1)
  110.     '    sqlstring = "UPDATE dbo_EMPLOYEENEED SET dbo_EMPLOYEENEED.NEEDPERDAY = " & sqlstring2(1, 0)
  111.     '    sqlstring = sqlstring & " WHERE dbo_EMPLOYEENEED.THERAPISTEMPLOYEEID like '" & Trim(sqlstring2(0, 0)) & "'"
  112.  
  113.         'DoCmd.RunSQL sqlstring
  114.  
  115.  
  116.     'End If
  117.  
  118. 'DoCmd.OpenQuery "LOAD DIRECTOR"
  119.  
  120.   '  notfound = 0
  121.  '   intRow = 0
  122.    ' lookup = "SELECT * FROM UPDATEASSESSORNEED"
  123.     'Set temprecord = CurrentDb.OpenRecordset(lookup)
  124.  
  125.  
  126.     'If temprecord.BOF <> temprecord.EOF Then
  127.      '   sqlstring2 = temprecord.GetRows(1)
  128.       '  sqlstring = "UPDATE dbo_EMPLOYEENEED SET dbo_EMPLOYEENEED.NEEDPERDAY = " & sqlstring2(1, 0)
  129.       '  sqlstring = sqlstring & " WHERE dbo_EMPLOYEENEED.ASSESSOREMPLOYEEID like '" & Trim(sqlstring2(0, 0)) & "'"
  130.  
  131.         'DoCmd.RunSQL sqlstring
  132.  
  133.  
  134.     'End If
  135.  
  136. 'DoCmd.OpenQuery "LOAD ASSESSOR"
  137.  
  138. End Sub
  139.  
  140. Private Sub LastName_AfterUpdate()
  141. filters
  142. End Sub
  143. Private Sub filters()
  144. Dim filterstr As String
  145. Dim filterlast As String
  146. Dim filterfirst As String
  147. Dim filterssn As String
  148. Dim filterdob As String
  149.  
  150. filterlast = IIf(IsNull(LastName) = False, "LastName Like '*" & Me.LastName & "*'", " ")
  151. filterfirst = IIf(IsNull(FirstName) = False, "FirstName Like '*" & Me.FirstName & "*'", " ")
  152. filterssn = IIf(IsNull(SSN) = False, "SSN Like '*" & Me.SSN & "*'", " ")
  153. filterdob = IIf(IsNull(BirthDate) = False, "DOB Like #" & Me.BirthDate & "#", " ")
  154.  
  155. 'MsgBox Len(filterdob)
  156.  
  157. If Len(filterlast) > 2 And Len(filterfirst) < 2 And Len(filterssn) < 2 And Len(filterdob) < 2 Then
  158.     filterstr = filterlast
  159.  
  160. ElseIf Len(filterlast) > 2 And Len(filterfirst) > 2 And Len(filterssn) < 2 And Len(filterdob) < 2 Then
  161.     filterstr = filterlast & " AND " & filterfirst
  162.  
  163. ElseIf Len(filterlast) > 2 And Len(filterfirst) > 2 And Len(filterssn) > 2 And Len(filterdob) < 2 Then
  164.     filterstr = filterlast & " AND " & filterfirst & " AND " & filterssn
  165.  
  166. ' Changed on line 25 below from & ";" & filterdob to "AND"
  167.  
  168. ElseIf Len(filterlast) > 2 And Len(filterfirst) > 2 And Len(filterssn) > 2 And Len(filterdob) > 2 Then
  169.     filterstr = filterlast & " AND " & filterfirst & " AND " & filterssn & "AND" & filterdob
  170.  
  171.  
  172. ElseIf Len(filterlast) > 2 And Len(filterfirst) < 2 And Len(filterssn) > 2 And Len(filterdob) < 2 Then
  173.     filterstr = filterlast & " AND " & filterssn
  174.  
  175. ElseIf Len(filterlast) < 2 And Len(filterfirst) > 2 And Len(filterssn) > 2 And Len(filterdob) > 2 Then
  176.     filterstr = filterfirst & " AND " & filterssn & " AND " & filterdob
  177.  
  178. ElseIf Len(filterlast) < 2 And Len(filterfirst) < 2 And Len(filterssn) > 2 And Len(filterdob) > 2 Then
  179.     filterstr = filterssn & " AND " & filterdob
  180.  
  181. ElseIf Len(filterlast) < 2 And Len(filterfirst) < 2 And Len(filterssn) < 2 And Len(filterdob) > 2 Then
  182.     filterstr = filterdob
  183.  
  184. End If
  185. Me.Referral.Form.Filter = filterstr
  186. Me.Referral.Form.FilterOn = True
  187. End Sub
  188.  
  189. Private Sub SSN_AfterUpdate()
  190. filters
  191. End Sub
  192.  
Jan 26 '15 #5
Rabbit
12,516 Expert Mod 8TB
It would help to see the filter string that it is attempting to use.

Also, it would be simpler in your code to build the string like this:
Expand|Select|Wrap|Line Numbers
  1. Dim strFilter As String
  2.  
  3. If Not IsNull(field1) Then
  4.    strFilter = strFilter & " AND field1 LIKE '*" & Me.formfield1 & "*'"
  5. End If
  6.  
  7. ... and so on for the other fields ...
  8.  
  9. strFilter = Mid(strFilter, 6)
Jan 26 '15 #6
W4FF
9
The Run-time Error'3075': error is gone but I still have the over flow error. Please help.
Jan 26 '15 #7
Rabbit
12,516 Expert Mod 8TB
It would help to see the filter string that it is attempting to use.
Jan 26 '15 #8
W4FF
9
I think this is it, the last guy in my department left me with this mess to fix, and i'm new to ACCESS

Expand|Select|Wrap|Line Numbers
  1. Private Sub ClearFilter_Click()
  2. clearfilters
  3. End Sub
  4. Private Sub AssessorId_AfterUpdate()
  5. Dim lookup As String
  6. Dim temprecord As Recordset
  7. Dim emailfind As String
  8. Dim var As Variant
  9.  
  10. DoCmd.SetWarnings (False)
  11. If IsNull(Me.AssessorId) = False Then
  12.     lookup = "SELECT Name, Email FROM VIEW_ASSESSOR_EMAIL WHERE ASSESSOREMPLOYEEID = '"
  13.     lookup = lookup & Me.AssessorId
  14.     lookup = lookup & "'"
  15.  
  16.     Set temprecord = CurrentDb.OpenRecordset(lookup)
  17.  
  18.     var = temprecord.GetRows(1)
  19.  
  20.     AssessorName.Caption = IIf(temprecord.RecordCount <> 0, "Name:" & var(0, 0), " ")
  21.     AssessorEmailName.Caption = IIf(temprecord.RecordCount <> 0, "Email:" & var(1, 0), " ")
  22. End If
  23. End Sub
  24.  
  25. Private Sub Command53_Click()
  26. clearfilters
  27. End Sub
  28. Private Sub clearfilters()
  29.     lookup = "SELECT ASSESSOREMPLOYEEID, NAME, ZONE, ORIGINALNEED, REFERRALCOUNT, AVAILABILITY  FROM VIEW_ASSESSOR_AVAILABLE "
  30.     lookup = lookup & " GROUP BY ASSESSOREMPLOYEEID, NAME, GENDER, ZONE, ORIGINALNEED, REFERRALCOUNT, AVAILABILITY "
  31. '    lookup = IIf(IsNull(Me.AssessmentZoneID), lookup, lookup & " HAVING Zone = '" & ZONES & "'")
  32. lookup = lookup & " ORDER BY ZONE ASC"
  33.     AssessorId.RowSource = lookup
  34.  
  35.  
  36.     lookup = "SELECT THERAPISTEMPLOYEEID, NAME, ZONE, NEED FROM VIEW_THERAPIST_AVAILABLE "
  37.     lookup = lookup & " GROUP BY THERAPISTEMPLOYEEID, NAME, GENDER, ZONE, NEED"
  38. '    lookup = IIf(IsNull(Me.ServiceZoneID), lookup, lookup & " HAVING Zone like '" & ZONES & "'")
  39. lookup = lookup & " ORDER BY ZONE ASC"
  40.  
  41.     TherapistId.RowSource = lookup
  42.  
  43.     Me.SCREENFILTER.Caption = "A"
  44. End Sub
  45.  
  46. Private Sub Command55_Click()
  47. Dim stDocName As String
  48. Dim stLinkCriteria As String
  49. Dim args As String
  50. Dim sqlstring As String
  51. Dim sqlstring2 As Variant
  52. Dim temprecord As Recordset
  53. Dim intRow As Integer
  54. Dim findid As Long
  55. Dim findString As String
  56.  
  57. Me.ModifiedByID = VBA.Environ("USERNAME")
  58. Me.CreateByID = VBA.Environ("USERNAME")
  59. Me.CreateDT = Now()
  60. Me.ModifiedDT = Now()
  61.  
  62.     sqlstring = "INSERT INTO [NOTE] (REFERRALID, [NOTE], INTAKEDT, CREATEDBY) VALUES("
  63.     sqlstring = sqlstring & Me.ReferralId & ", 'EPISODE OF CARE CREATED', #" & Now() & "#, '" & VBA.Environ("USERNAME") & "')"
  64.     DoCmd.RunSQL (sqlstring)
  65.  
  66. DoCmd.RunCommand acCmdSaveRecord
  67.     notfound = 0
  68.     intRow = 0
  69.  
  70.  
  71.    findid = ReferralId
  72.    stDocName = "F_EDIT"
  73.    findString = "ReferralID = " & findid
  74.    DoCmd.Close acForm, "REFERRALSERVICES_Add"
  75. '   DoCmd.OpenForm stDocName, findString, findString
  76.  
  77. End Sub
  78.  
  79. Private Sub EmailTherapist_Click()
  80. Dim lookup As String
  81. Dim temprecord As Recordset
  82. Dim emailfind As String
  83. Dim var As Variant
  84.  
  85. DoCmd.SetWarnings (False)
  86. 'Did you add ALS
  87.  
  88.     lookup = "SELECT Name, Email FROM VIEW_THERAPIST_EMAIL WHERE THERAPISTEMPLOYEEIDs = '"
  89.     lookup = lookup & Me.TherapistId
  90.     lookup = lookup & "'"
  91.  
  92.     Set temprecord = CurrentDb.OpenRecordset(lookup)
  93.     var = temprecord.GetRows(1)
  94.  
  95.     If temprecord.RecordCount <> 0 Then
  96.         DoCmd.RunCommand acCmdSaveRecord
  97.         DoCmd.OpenForm "F_PDF", acPreview, "ReferralID = Forms!F_Edit!ReferralID", "ReferralID =" & Forms!F_Edit!ReferralId
  98.         DoCmd.SendObject acSendForm, "F_PDF", acFormatPDF, var(1, 0), "portal@test.COM"
  99.         DoCmd.Close acForm, "F_PDF"
  100.     End If
  101.  
  102. End Sub
  103.  
  104.  
  105. Private Sub EmailAssessor_Click()
  106. Dim lookup As String
  107. Dim temprecord As Recordset
  108. Dim emailfind As String
  109. Dim var As Variant
  110.  
  111. DoCmd.SetWarnings (False)
  112. 'Did you add ALS
  113. lookup = "SELECT name, Email FROM VIEW_ASSESSOR_EMAIL WHERE ASSESSOREMPLOYEEID = '"
  114. lookup = lookup & Me.AssessorId
  115. lookup = lookup & "'"
  116. Set temprecord = CurrentDb.OpenRecordset(lookup)
  117.  
  118. If temprecord.RecordCount <> 0 Then
  119.     var = temprecord.GetRows(1)
  120.     DoCmd.RunCommand acCmdSaveRecord
  121.         DoCmd.OpenForm "F_PDF", acPreview, "ReferralID = ReferralID", "ReferralID =" & ReferralId
  122.     DoCmd.SendObject acSendForm, "F_PDF", acFormatPDF, var(1, 0), , "portal@test.COM"
  123.     DoCmd.Close acForm, "F_PDF"
  124. End If
  125.  
  126.  
  127. End Sub
  128.  
  129.  
  130.  
  131. Private Sub Form_Current()
  132. Dim lookup As String
  133. Dim temprecord As Recordset
  134. Dim emailfind As String
  135. Dim var As Variant
  136. Dim strValue As String
  137. Dim counter As Integer
  138. Dim sqlstring As String
  139. Dim sqlstring2 As Variant
  140. Dim temprecords As Recordset
  141. Dim referralidnew As Long
  142.   Form.FilterOn = False
  143. Form.FilterOn = True
  144.   Me.ReferralId = Me.OpenArgs
  145.  
  146.     lookup = "SELECT LASTNAME & ', ' & FIRSTNAME, servicezoneid, assessmentzoneid, school, PreferredLanguageforAssessment, PreferredLanguageforService, servicelocation, assessmentlocation from Referral WHERE ReferralID = "
  147.     lookup = lookup & Me.ReferralId
  148.  
  149.     Set temprecord = CurrentDb.OpenRecordset(lookup)
  150.  
  151.     var = temprecord.GetRows(1)
  152.  
  153. If var(6, 0) = "School" Or var(7, 0) = "School" Then
  154. Me.School = var(3, 0)
  155. End If
  156. Me.ReferralName.Caption = var(0, 0)
  157. Me.ServiceZoneID = var(1, 0)
  158. Me.AssessmentZoneID = var(2, 0)
  159. Me.LanguageAssessment = var(4, 0)
  160. Me.LanguageServices = var(5, 0)
  161.  
  162. Me.SCREENFILTER.Caption = "A"
  163. DoCmd.SetWarnings (False)
  164. If IsNull(Me.AssessorId) = False Then
  165.     lookup = "SELECT Name, Email FROM VIEW_ASSESSOR_EMAIL WHERE ASSESSOREMPLOYEEID like '"
  166.     lookup = lookup & Me.AssessorId
  167.     lookup = lookup & "'"
  168.  
  169.     Set temprecord = CurrentDb.OpenRecordset(lookup)
  170.  
  171.     var = temprecord.GetRows(1)
  172.  
  173.     AssessorName.Caption = IIf(temprecord.RecordCount <> 0, var(0, 0), " ")
  174.     AssessorEmailName.Caption = IIf(temprecord.RecordCount <> 0, var(1, 0), " ")
  175.     Me.SCREENFILTER.Caption = "C"
  176. Else
  177.     AssessorName.Caption = ""
  178.     AssessorEmailName.Caption = ""
  179.     ENABLEFILTER
  180. End If
  181.  
  182. If IsNull(Me.TherapistId) = False Then
  183.     lookup = "SELECT Name, Email FROM VIEW_THERAPIST_EMAIL WHERE THERAPISTEMPLOYEEIDs like '"
  184.     lookup = lookup & Me.TherapistId
  185.     lookup = lookup & "'"
  186.  
  187.     Set temprecord = CurrentDb.OpenRecordset(lookup)
  188.     var = temprecord.GetRows(1)
  189.  
  190.     TherapistName.Caption = IIf(temprecord.RecordCount <> 0, var(0, 0), " ")
  191.     TherapistEmailName.Caption = IIf(temprecord.RecordCount <> 0, var(1, 0), " ")
  192.     Me.SCREENFILTER.Caption = "C"
  193. Else
  194.     TherapistName.Caption = ""
  195.     TherapistEmailName.Caption = ""
  196.     ENABLEFILTER
  197. End If
  198.  
  199.  
  200. End Sub
  201.  
  202. Private Sub Form_Load()
  203. Dim lookup As String
  204. Dim temprecord As Recordset
  205. Dim emailfind As String
  206. Dim var As Variant
  207. Dim strValue As String
  208. Dim counter As Integer
  209. Dim sqlstring As String
  210. Dim sqlstring2 As Variant
  211. Dim temprecords As Recordset
  212. Dim referralidnew As Long
  213.  
  214. If Len(Me.oldtherapist) = 0 Then
  215.     Me.oldtherapist = "NO VALUE"
  216. Else
  217.     Me.oldtherapist = Me.TherapistId
  218. End If
  219.  
  220.   Form.FilterOn = False
  221. Form.FilterOn = True
  222.   Me.ReferralId = Me.OpenArgs
  223.     lookup = "SELECT LASTNAME & ', ' & FIRSTNAME, servicezoneid, assessmentzoneid, school, PreferredLanguageforAssessment, PreferredLanguageforService, servicelocation, assessmentlocation from Referral WHERE ReferralID = "
  224.     lookup = lookup & Me.ReferralId
  225.  
  226.     Set temprecord = CurrentDb.OpenRecordset(lookup)
  227.  
  228.     var = temprecord.GetRows(1)
  229.  
  230. If var(6, 0) = "School" Or var(7, 0) = "School" Then
  231. Me.School = var(3, 0)
  232. End If
  233. Me.ReferralName.Caption = var(0, 0)
  234. Me.ServiceZoneID = var(1, 0)
  235. Me.AssessmentZoneID = var(2, 0)
  236. Me.LanguageAssessment = var(4, 0)
  237. Me.LanguageServices = var(5, 0)
  238. Me.SCREENFILTER.Caption = "A"
  239. DoCmd.SetWarnings (False)
  240. If IsNull(Me.AssessorId) = False Then
  241.     lookup = "SELECT Name, Email FROM VIEW_ASSESSOR_EMAIL WHERE ASSESSOREMPLOYEEID like '"
  242.     lookup = lookup & Me.AssessorId
  243.     lookup = lookup & "'"
  244.  
  245.     Set temprecord = CurrentDb.OpenRecordset(lookup)
  246.  
  247.     var = temprecord.GetRows(1)
  248.  
  249.     AssessorName.Caption = IIf(temprecord.RecordCount <> 0, var(0, 0), " ")
  250.     AssessorEmailName.Caption = IIf(temprecord.RecordCount <> 0, var(1, 0), " ")
  251.     Me.SCREENFILTER.Caption = "C"
  252. Else
  253.     AssessorName.Caption = ""
  254.     AssessorEmailName.Caption = ""
  255.     ENABLEFILTER
  256. End If
  257.  
  258. If IsNull(Me.TherapistId) = False Then
  259.     lookup = "SELECT Name, Email FROM VIEW_THERAPIST_EMAIL WHERE THERAPISTEMPLOYEEIDs like '"
  260.     lookup = lookup & Me.TherapistId
  261.     lookup = lookup & "'"
  262.  
  263.     Set temprecord = CurrentDb.OpenRecordset(lookup)
  264.     var = temprecord.GetRows(1)
  265.  
  266.     TherapistName.Caption = IIf(temprecord.RecordCount <> 0, var(0, 0), " ")
  267.     TherapistEmailName.Caption = IIf(temprecord.RecordCount <> 0, var(1, 0), " ")
  268.     Me.SCREENFILTER.Caption = "C"
  269. Else
  270.     TherapistName.Caption = ""
  271.     TherapistEmailName.Caption = ""
  272.     ENABLEFILTER
  273. End If
  274.  
  275.  
  276. End Sub
  277. Private Sub ENABLEFILTER()
  278. Me.SCREENFILTER.Caption = "B"
  279.  
  280. End Sub
  281.  
  282. Private Sub Form_Open(Cancel As Integer)
  283. Dim lookup As String
  284. Dim temprecord As Recordset
  285. Dim emailfind As String
  286. Dim var As Variant
  287. Dim strValue As String
  288. Dim counter As Integer
  289. Dim sqlstring As String
  290. Dim sqlstring2 As Variant
  291. Dim temprecords As Recordset
  292. Dim referralidnew As Long
  293.  
  294. Me.SCREENFILTER.Caption = "A"
  295. DoCmd.SetWarnings (False)
  296. If IsNull(Me.AssessorId) = False Then
  297.     lookup = "SELECT Name, Email FROM VIEW_ASSESSOR_EMAIL WHERE ASSESSOREMPLOYEEID like '"
  298.     lookup = lookup & Me.AssessorId
  299.     lookup = lookup & "'"
  300.  
  301.     Set temprecord = CurrentDb.OpenRecordset(lookup)
  302.  
  303.     var = temprecord.GetRows(1)
  304.  
  305.     AssessorName.Caption = IIf(temprecord.RecordCount <> 0, var(0, 0), " ")
  306.     AssessorEmailName.Caption = IIf(temprecord.RecordCount <> 0, var(1, 0), " ")
  307.     Me.SCREENFILTER.Caption = "C"
  308. Else
  309.     AssessorName.Caption = ""
  310.     AssessorEmailName.Caption = ""
  311.  
  312. End If
  313.  
  314. If IsNull(Me.TherapistId) = False Then
  315.     lookup = "SELECT Name, Email FROM VIEW_THERAPIST_EMAIL WHERE THERAPISTEMPLOYEEIDs like '"
  316.     lookup = lookup & Me.TherapistId
  317.     lookup = lookup & "'"
  318.  
  319.     Set temprecord = CurrentDb.OpenRecordset(lookup)
  320.     var = temprecord.GetRows(1)
  321.  
  322.     TherapistName.Caption = IIf(temprecord.RecordCount <> 0, var(0, 0), " ")
  323.     TherapistEmailName.Caption = IIf(temprecord.RecordCount <> 0, var(1, 0), " ")
  324.     Me.SCREENFILTER.Caption = "C"
  325. Else
  326.     TherapistName.Caption = ""
  327.     TherapistEmailName.Caption = ""
  328.  
  329. End If
  330.  
  331. End Sub
  332.  
  333. Private Sub GenderRequirements_BeforeUpdate(Cancel As Integer)
  334. ENABLEFILTER
  335. End Sub
  336.  
  337. Private Sub LicensedRequired_AfterUpdate()
  338. ENABLEFILTER
  339. End Sub
  340.  
  341. Private Sub SafetyRequired_AfterUpdate()
  342. ENABLEFILTER
  343. End Sub
  344.  
  345. Private Sub School_AfterUpdate()
  346. ENABLEFILTER
  347. End Sub
  348.  
  349. Private Sub StaartRequired_AfterUpdate()
  350. ENABLEFILTER
  351. End Sub
  352.  
  353. Private Sub StatusId_AfterUpdate()
  354. If Left(Me.StatusId, 8) = "Inactive" Then
  355.     Me.InactiveDT = FormatDateTime(Now, vbShortDate)
  356.     Me.InactiveReason.SetFocus
  357.  
  358. ElseIf Me.StatusId = "Discharged" Then
  359.     Me.InactiveDT = FormatDateTime(Now, vbShortDate)
  360.  
  361. ElseIf Me.StatusId = "Client" Then
  362.     Me.InactiveDT = FormatDateTime(Now + 365, vbShortDate)
  363. End If
  364. End Sub
  365.  
  366. Private Sub AssessorId_Enter()
  367. Dim ZONES As String
  368. Dim LICENSES As String
  369. Dim TRAINS As String
  370. Dim CreoleS  As String
  371. Dim FrenchS As String
  372. Dim ItalianS As String
  373. Dim PortugueseS As String
  374. Dim RussianS As String
  375. Dim SpanishS As String
  376. Dim GENDERS As String
  377.  
  378. DoCmd.SetWarnings (False)
  379.  
  380. ZONES = IIf(IsNull(AssessmentZoneID), "", Me.AssessmentZoneID)
  381. If IsNull(Me.LicensedRequired) Then
  382.     LICENSES = ""
  383. Else
  384.     LICENSES = IIf(Me.LicensedRequired = 0, "", "YES")
  385. End If
  386. If IsNull(Me.SafetyTrainingRequired) And IsNull(Me.StaartTrainingRequired) Then
  387.     TRAINS = ""
  388. Else
  389.     TRAINS = IIf((Me.SafetyTrainingRequired + Me.StaartTrainingRequired) < 1, "", "YES")
  390. End If
  391. If IsNull(Me.GenderRequirements) Then
  392.     GENDERS = ""
  393. Else
  394.     GENDERS = IIf(Me.GenderRequirements = "FEMALE", "FEMALE", "MALE")
  395. End If
  396. CreoleS = IIf(Me.LanguageAssessment = "Creole", "YES", "")
  397. FrenchS = IIf(Me.LanguageAssessment = "French", "YES", "")
  398. ItalianS = IIf(Me.LanguageAssessment = "Italian", "YES", "")
  399. PortugueseS = IIf(Me.LanguageAssessment = "Portuguese", "YES", "")
  400. RussianS = IIf(Me.LanguageAssessment = "Russian", "YES", "")
  401. SpanishS = IIf(Me.LanguageAssessment = "Spanish", "YES", "")
  402.  
  403.  
  404. If Me.SCREENFILTER.Caption = "B" Then
  405.     If IsNull(School) = False Then
  406.         lookup = "SELECT ASSESSOREMPLOYEEID, NAME, ZONE, NEED, REFERRALCOUNT, AVAILABILITY, SCHOOL "
  407.         lookup = lookup & "FROM VIEW_SELECTASSESSORWITHSCHOOL "
  408.         lookup = lookup & "GROUP BY ASSESSOREMPLOYEEID, NAME, NEED, REFERRALCOUNT, AVAILABILITY, SCHOOL,"
  409.         lookup = lookup & "GENDER, ZONE, LICENSE, TRAIN, CREOLE, FRENCH, ITALIAN, PORTUGUESE, RUSSIAN, SPANISH "
  410.         lookup = lookup & "HAVING "
  411.         lookup = lookup & "SCHOOL='" & Me.School & "' "
  412.         lookup = IIf(Len(GENDERS) < 2, lookup, lookup & "AND GENDER = '" & GENDERS & "' ")
  413.         lookup = IIf(Len(ZONESS) < 2, lookup, lookup & "AND ZONE = '" & ZONES & "' ")
  414.         lookup = IIf(Len(LICENSES) < 2, lookup, lookup & "AND LICENSE = '" & LICENSES & "' ")
  415.         lookup = IIf(Len(TRAINS) < 2, lookup, lookup & "AND TRAIN = '" & TRAINS & "' ")
  416.         lookup = IIf(Len(CreoleS) < 2, lookup, lookup & "AND CREOLE = '" & CreoleS & "' ")
  417.         lookup = IIf(Len(FrenchS) < 2, lookup, lookup & "AND French = '" & FrenchS & "' ")
  418.         lookup = IIf(Len(ItalianS) < 2, lookup, lookup & "AND Italian = '" & ItalianS & "' ")
  419.         lookup = IIf(Len(PortugueseS) < 2, lookup, lookup & "AND Portuguese = '" & PortugueseS & "' ")
  420.         lookup = IIf(Len(RussianS) < 2, lookup, lookup & "AND Russian = '" & RussianS & "' ")
  421.         lookup = IIf(Len(SpanishS) < 2, lookup, lookup & "AND Spanish = '" & SpanishS & "' ")
  422.         lookup = lookup & "ORDER BY ZONE ASC"
  423.  
  424.  
  425.     Else
  426.         lookup = "SELECT ASSESSOREMPLOYEEID, NAME, ZONE, NEED, REFERRALCOUNT, AVAILABILITY, SCHOOL "
  427.         lookup = lookup & "FROM VIEW_ASSESSOR_AVAILABLE_GROUP "
  428.         lookup = lookup & "GROUP BY ASSESSOREMPLOYEEID, NAME, NEED, REFERRALCOUNT, AVAILABILITY, SCHOOL,"
  429.         lookup = lookup & "GENDER, ZONE, LICENSE, TRAIN, CREOLE, FRENCH, ITALIAN, PORTUGUESE, RUSSIAN, SPANISH "
  430.         lookup = lookup & "HAVING "
  431.         LOOKUP2 = IIf(Len(GENDERS) < 2, LOOKUP2, LOOKUP2 & "AND GENDER = '" & GENDERS & "' ")
  432.         LOOKUP2 = IIf(Len(ZONES) < 2, LOOKUP2, LOOKUP2 & "AND ZONE = '" & ZONES & "' ")
  433.         LOOKUP2 = IIf(Len(LICENSES) < 2, LOOKUP2, LOOKUP2 & "AND LICENSE = '" & LICENSES & "' ")
  434.         LOOKUP2 = IIf(Len(TRAINS) < 2, LOOKUP2, LOOKUP2 & "AND TRAIN = '" & TRAINS & "' ")
  435.         LOOKUP2 = IIf(Len(CreoleS) < 2, LOOKUP2, LOOKUP2 & "AND CREOLE = '" & CreoleS & "' ")
  436.         LOOKUP2 = IIf(Len(FrenchS) < 2, LOOKUP2, LOOKUP2 & "AND French = '" & FrenchS & "' ")
  437.         LOOKUP2 = IIf(Len(ItalianS) < 2, LOOKUP2, LOOKUP2 & "AND Italian = '" & ItalianS & "' ")
  438.         LOOKUP2 = IIf(Len(PortugueseS) < 2, LOOKUP2, LOOKUP2 & "AND Portuguese = '" & PortugueseS & "' ")
  439.         LOOKUP2 = IIf(Len(RussianS) < 2, LOOKUP2, LOOKUP2 & "AND Russian = '" & RussianS & "' ")
  440.         LOOKUP2 = IIf(Len(SpanishS) < 2, LOOKUP2, LOOKUP2 & "AND Spanish = '" & SpanishS & "' ")
  441.         SIZES = Len(LOOKUP2)
  442.         lookup = lookup & Mid(LOOKUP2, 5, SIZES - 5)
  443.         lookup = lookup & "ORDER BY ZONE ASC"
  444.  
  445.     End If
  446. End If
  447.  
  448.  
  449.  
  450. 'MsgBox lookup
  451. If SCREENFILTER.Caption = "A" Then
  452.     Me.SCREENFILTER.Caption = "B"
  453.     lookup = "SELECT ASSESSOREMPLOYEEID, NAME, ZONE, NEED, REFERRALCOUNT, AVAILABILITY  FROM VIEW_ASSESSOR_AVAILABLE "
  454.     lookup = lookup & " GROUP BY ASSESSOREMPLOYEEID, NAME, GENDER, ZONE, NEED, REFERRALCOUNT, AVAILABILITY "
  455.     lookup = lookup & "ORDER BY ZONE ASC"
  456.  
  457. End If
  458.     AssessorId.RowSource = lookup
  459.  
  460. Me.Text50 = lookup
  461. End Sub
  462.  
  463. Private Sub TherapistId_AfterUpdate()
  464. Dim lookup As String
  465. Dim temprecord As Recordset
  466.     Dim emailfind As String
  467. Dim var As Variant
  468.  
  469. DoCmd.SetWarnings (False)
  470. If IsNull(Me.TherapistId) = False Then
  471.     lookup = "SELECT Name, Email FROM VIEW_therapist_EMAIL WHERE therapistEMPLOYEEIDs = '"
  472.     lookup = lookup & Me.TherapistId
  473.     lookup = lookup & "'"
  474.  
  475.     Set temprecord = CurrentDb.OpenRecordset(lookup)
  476.     var = temprecord.GetRows(1)
  477.  
  478.     TherapistName.Caption = IIf(temprecord.RecordCount <> 0, var(0, 0), " ")
  479.     TherapistEmailName.Caption = IIf(temprecord.RecordCount <> 0, var(1, 0), " ")
  480. End If
  481.  
  482. If Len(Me.oldtherapist) > 0 And IsNull(Me.TherapistId) Then
  483.     lookup = "SELECT needperday FROM therapistneed WHERE EMPLOYID = '"
  484.     lookup = lookup & Me.oldtherapist
  485.     lookup = lookup & "'"
  486.  
  487.     Set temprecord = CurrentDb.OpenRecordset(lookup)
  488.     If temprecord.EOF <> True Then
  489.  
  490.             var = temprecord.GetRows(1)
  491.             newneed = var(0, 0) + 1
  492.             sqlstring = "UPDATE dbo_EMPLOYEENEED "
  493.             sqlstring = sqlstring & "SET NEEDPERDAY = " & newneed
  494.             sqlstring = sqlstring & " WHERE THERAPISTEMPLOYEEID = '" & Me.oldtherapist & "'"
  495.             DoCmd.RunSQL sqlstring
  496.             MsgBox "Therapist Need has been restored"
  497.     End If
  498.  
  499. ElseIf IsNull(Me.TherapistId) = False And IsNull(Me.oldtherapist) Then
  500.                 lookup = "SELECT needperday FROM therapistneed WHERE EMPLOYID = '"
  501.                 lookup = lookup & Me.TherapistId
  502.                 lookup = lookup & "'"
  503.  
  504.                 Set temprecord = CurrentDb.OpenRecordset(lookup)
  505.                 If temprecord.EOF <> True Then
  506.                     var = temprecord.GetRows(1)
  507.  
  508.                     newneed = var(0, 0) - 1
  509.                     sqlstring = "UPDATE dbo_EMPLOYEENEED "
  510.                     sqlstring = sqlstring & "SET NEEDPERDAY = " & newneed
  511.                     sqlstring = sqlstring & " WHERE THERAPISTEMPLOYEEID = '" & Me.TherapistId & "'"
  512.                     DoCmd.RunSQL sqlstring
  513.                     MsgBox "Therapist Need has been reduced"
  514.                 End If
  515. ElseIf IsNull(Me.TherapistId) = False And Me.oldtherapist <> Me.TherapistId Then
  516.                 lookup = "SELECT needperday FROM therapistneed WHERE EMPLOYID = '"
  517.                 lookup = lookup & Me.oldtherapist
  518.                 lookup = lookup & "'"
  519.  
  520.                 Set temprecord = CurrentDb.OpenRecordset(lookup)
  521.                 If temprecord.EOF <> True Then
  522.                     var = temprecord.GetRows(1)
  523.  
  524.                     newneed = var(0, 0) + 1
  525.                     sqlstring = "UPDATE dbo_EMPLOYEENEED "
  526.                     sqlstring = sqlstring & "SET NEEDPERDAY = " & newneed
  527.                     sqlstring = sqlstring & " WHERE THERAPISTEMPLOYEEID = '" & Me.oldtherapist & "'"
  528.                     DoCmd.RunSQL sqlstring
  529.                 End If
  530.                 lookup = "SELECT needperday FROM therapistneed WHERE EMPLOYID = '"
  531.                 lookup = lookup & Me.TherapistId
  532.                 lookup = lookup & "'"
  533.  
  534.                 Set temprecord = CurrentDb.OpenRecordset(lookup)
  535.                 If temprecord.EOF <> True Then
  536.                     var = temprecord.GetRows(1)
  537.  
  538.                     newneed = var(0, 0) - 1
  539.                     sqlstring = "UPDATE dbo_EMPLOYEENEED "
  540.                     sqlstring = sqlstring & "SET NEEDPERDAY = " & newneed
  541.                     sqlstring = sqlstring & " WHERE THERAPISTEMPLOYEEID = '" & Me.TherapistId & "'"
  542.                     DoCmd.RunSQL sqlstring
  543.                 End If
  544.             MsgBox Me.oldtherapist & " need has been increase by 1 and " & Me.TherapistId & " need has been reduced by 1"
  545.         End If
  546. End Sub
  547.  
  548. Private Sub TherapistId_Enter()
  549. Dim LICENSES As String
  550. Dim TRAINS As String
  551. Dim CreoleS  As String
  552. Dim FrenchS As String
  553. Dim ItalianS As String
  554. Dim PortugueseS As String
  555. Dim RussianS As String
  556. Dim SpanishS As String
  557. Dim GENDERS As String
  558.  
  559. DoCmd.SetWarnings (False)
  560.  
  561. ZONES = IIf(IsNull(ServiceZoneID), "", Me.ServiceZoneID)
  562.  
  563. If IsNull(Me.LicensedRequired) Then
  564.     LICENSES = ""
  565. Else
  566.     LICENSES = IIf(Me.LicensedRequired = 0, "", "YES")
  567. End If
  568.  
  569. If IsNull(Me.SafetyTrainingRequired) And IsNull(Me.StaartTrainingRequired) Then
  570.     TRAINS = ""
  571. Else
  572.     TRAINS = IIf((Me.SafetyTrainingRequired + Me.StaartTrainingRequired) < 1, "", "YES")
  573. End If
  574.  
  575. If IsNull(Me.GenderRequirements) Then
  576.     GENDERS = ""
  577. Else
  578.     GENDERS = IIf(Me.GenderRequirements = "FEMALE", "FEMALE", "MALE")
  579. End If
  580.  
  581. CreoleS = IIf(Me.LanguageServices = "Creole", "YES", "")
  582. FrenchS = IIf(Me.LanguageServices = "French", "YES", "")
  583. ItalianS = IIf(Me.LanguageServices = "Italian", "YES", "")
  584. PortugueseS = IIf(Me.LanguageServices = "Portuguese", "YES", "")
  585. RussianS = IIf(Me.LanguageServices = "Russian", "YES", "")
  586. SpanishS = IIf(Me.LanguageServices = "Spanish", "YES", "")
  587.  
  588. If Me.SCREENFILTER.Caption = "B" Then
  589.     If IsNull(School) = False Then
  590.     lookup = "SELECT THERAPISTEMPLOYEEID, NAME, ZONE, NEED, SCHOOL "
  591.     lookup = lookup & "FROM VIEW_SELECTTHERAPISTWITHSCHOOL "
  592.     lookup = lookup & "GROUP BY THERAPISTEMPLOYEEID, NAME, GENDER, ZONE, NEED, SCHOOL,"
  593.         lookup = lookup & "GENDER, ZONE, LICENSE, TRAIN, CREOLE, FRENCH, ITALIAN, PORTUGUESE, RUSSIAN, SPANISH "
  594.         lookup = lookup & "HAVING "
  595.         lookup = lookup & "SCHOOL='" & Me.School & "' "
  596.         lookup = IIf(Len(GENDERS) < 2, lookup, lookup & "AND GENDER = '" & GENDERS & "' ")
  597.         lookup = IIf(Len(ZONESS) < 2, lookup, lookup & "AND ZONE = '" & ZONES & "' ")
  598.         lookup = IIf(Len(LICENSES) < 2, lookup, lookup & "AND LICENSE = '" & LICENSES & "' ")
  599.         lookup = IIf(Len(TRAINS) < 2, lookup, lookup & "AND TRAIN = '" & TRAINS & "' ")
  600.         lookup = IIf(Len(CreoleS) < 2, lookup, lookup & "AND CREOLE = '" & CreoleS & "' ")
  601.         lookup = IIf(Len(FrenchS) < 2, lookup, lookup & "AND French = '" & FrenchS & "' ")
  602.         lookup = IIf(Len(ItalianS) < 2, lookup, lookup & "AND Italian = '" & ItalianS & "' ")
  603.         lookup = IIf(Len(PortugueseS) < 2, lookup, lookup & "AND Portuguese = '" & PortugueseS & "' ")
  604.         lookup = IIf(Len(RussianS) < 2, lookup, lookup & "AND Russian = '" & RussianS & "' ")
  605.         lookup = IIf(Len(SpanishS) < 2, lookup, lookup & "AND Spanish = '" & SpanishS & "' ")
  606. lookup = lookup & "ORDER BY ZONE ASC"
  607.  
  608.     Else
  609.     lookup = "SELECT THERAPISTEMPLOYEEID, NAME, ZONE, NEED, SCHOOL "
  610.         lookup = lookup & "FROM VIEW_THERAPIST_AVAILABLE_GROUP "
  611.         lookup = lookup & "GROUP BY THERAPISTEMPLOYEEID, NAME, NEED, SCHOOL,"
  612.         lookup = lookup & "GENDER, ZONE, LICENSE, TRAIN, CREOLE, FRENCH, ITALIAN, PORTUGUESE, RUSSIAN, SPANISH "
  613.         lookup = lookup & "HAVING "
  614.         LOOKUP2 = IIf(Len(GENDERS) < 2, LOOKUP2, LOOKUP2 & "AND GENDER = '" & GENDERS & "' ")
  615.         LOOKUP2 = IIf(Len(ZONES) < 2, LOOKUP2, LOOKUP2 & "AND ZONE = '" & ZONES & "' ")
  616.         LOOKUP2 = IIf(Len(LICENSES) < 2, LOOKUP2, LOOKUP2 & "AND LICENSE = '" & LICENSES & "' ")
  617.         LOOKUP2 = IIf(Len(TRAINS) < 2, LOOKUP2, LOOKUP2 & "AND TRAIN = '" & TRAINS & "' ")
  618.         LOOKUP2 = IIf(Len(CreoleS) < 2, LOOKUP2, LOOKUP2 & "AND CREOLE = '" & CreoleS & "' ")
  619.         LOOKUP2 = IIf(Len(FrenchS) < 2, LOOKUP2, LOOKUP2 & "AND French = '" & FrenchS & "' ")
  620.         LOOKUP2 = IIf(Len(ItalianS) < 2, LOOKUP2, LOOKUP2 & "AND Italian = '" & ItalianS & "' ")
  621.         LOOKUP2 = IIf(Len(PortugueseS) < 2, LOOKUP2, LOOKUP2 & "AND Portuguese = '" & PortugueseS & "' ")
  622.         LOOKUP2 = IIf(Len(RussianS) < 2, LOOKUP2, LOOKUP2 & "AND Russian = '" & RussianS & "' ")
  623.         LOOKUP2 = IIf(Len(SpanishS) < 2, LOOKUP2, LOOKUP2 & "AND Spanish = '" & SpanishS & "' ")
  624.         SIZES = Len(LOOKUP2)
  625.         lookup = lookup & Mid(LOOKUP2, 5, SIZES - 5)
  626.         lookup = lookup & "ORDER BY ZONE ASC"
  627.  
  628.     End If
  629. End If
  630.  
  631.  
  632.  
  633.  
  634. 'MsgBox lookup
  635. If SCREENFILTER.Caption = "A" Then
  636.  
  637.     Me.SCREENFILTER.Caption = "B"
  638.     lookup = "SELECT THERAPISTEMPLOYEEID, NAME, ZONE, NEED FROM VIEW_THERAPIST_AVAILABLE "
  639.     lookup = lookup & " GROUP BY THERAPISTEMPLOYEEID, NAME, GENDER, ZONE, NEED"
  640.         lookup = lookup & " ORDER BY ZONE ASC"
  641.  
  642. End If
  643.     TherapistId.RowSource = lookup
  644.  
  645. Me.Text50 = lookup
  646.  
  647. End Sub
  648.  
  649.  
  650.  
Jan 26 '15 #9
Rabbit
12,516 Expert Mod 8TB
I'm not talking about the code, you've already shown us the code. I mean the actual string it is trying to put into the Filter.
Jan 26 '15 #10
W4FF
9
Rabbit I'm not a pro at this and where would I find the actual string it is trying to put into the Filter?
Jan 27 '15 #11
Rabbit
12,516 Expert Mod 8TB
You can put a debug.print or msgbox after you build the string.
Jan 27 '15 #12
Stewart Ross
2,545 Expert Mod 2GB
Line 169, the replacement you made following on from what I suggested, is still in error. You have to have spaces on either side of the AND keyword, which you have left out:

filterstr = filterlast & " AND " & filterfirst & " AND " & filterssn & "AND" & filterdob

It is essential that the spaces be included, as they were in my answer to you:

filterstr = filterlast & " AND " & filterfirst & " AND " & filterssn & " AND " & filterdob

-Stewart
Jan 27 '15 #13
W4FF
9
Yes I did add spaces, and I still get an overflow error. By the way thank you both for your help, I'm truly grateful.
Jan 27 '15 #14
Stewart Ross
2,545 Expert Mod 2GB
Use the Debug option to find out what line the overflow is occurring on. Overflow errors can result from division of a number by zero, or from using a type such as integer with a value that cannot be contained in that type (e.g. a positive number greater than 32767 in the case of an integer). Without knowing the circumstances it is difficult to advise on this one.

-Stewart
Jan 27 '15 #15
zmbd
5,501 Expert Mod 4TB
Code Block Post#5
Lines:
184. End If
185. Me.Referral.Form.Filter = filterstr


Change to:
184. End If
(184a) debug.print filterstr
(184b) stop
185. Me.Referral.Form.Filter = filterstr


Now run.
Once the debugger stops on the command at 184b press <ctrl><g> to open the immediate window and you should see the resolved string from "filterstr"
Jan 27 '15 #16
W4FF
9
When I press <ctrl><g> I get the following from the window: LastName Like '*Mike*'

Do you think this might cause the overflow issue?
Jan 28 '15 #17
Stewart Ross
2,545 Expert Mod 2GB
From what you have posted, the short answer is that the overflow does not result from the application of that filter.

Overflows result from numeric issues - division by zero or exceeding the number of digits that can be stored in a numeric value. We'd still need you to use the debugger when the overflow occurs and note where in your code it is erroring.

-Stewart
Jan 28 '15 #18
Rabbit
12,516 Expert Mod 8TB
When you restart the code from the break point, does it give you the error?
Jan 28 '15 #19

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: brazilnut | last post by:
Hi. Let me explain the setup. I am using Visual Studio .NET to develop a sort of add-in (COM class) for Excel called SQLAddin. It basically queries a SQL server and pulls in data. Now within my...
1
by: manish | last post by:
Hi, I am a fresher in the programming field i.e although I have done programming at the basic level but at professional level I am very new and I am facing many problems. These probllems are...
1
by: Hines | last post by:
Hi, Can someone tell me what's the cause of this error. Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent...
4
by: Richard Hollenbeck | last post by:
I thought I was very specific in this SQL request. There is a form open with a selected record (and a corresponding "lngRecipeID" on that form. The table also has a field called "lngRecipeID". ...
2
by: ronboris | last post by:
i wrote and compiled an vb 6 program on a windows xp sp2 box i am trying to run the program via a batch file from an nt box i get this error: runtime error 91: object variable or With block...
1
by: ydprasad | last post by:
I am trying to convert the code that was written in VB using DAO to ADO. But when i tried to do following getting an error '3251'. *************code************************** Dim cn As New...
0
by: Prajyot Mahindrakar | last post by:
Hi All , I am facing the error in Data Access Project .I have written following code for Database Connection Set dbconn = New ADODB.Connection dbconn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data...
3
by: Peachstone | last post by:
I'm using Windows XP and MS Access 2002. I am trying to write code in VB which is attached to a text control on a form called "Scripture1". I have another text control on the same form called...
8
by: tgit | last post by:
Hi, I have moved application from windows 2000 to xp platform. I am using Access 2003. I am getting the error during a insert operation on table. Error: runtime error '-2147467259)' ODBC...
4
by: ielamrani | last post by:
Hi, I am getting this error when I try to export to an excel sheet. When I click on a button to export the first time it's fine, I rename the exported excel sheet and I try to export it again and I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.