I have been asked to build on top of one of the premade databases on Access 2010, the student database. I have been making new forms to mirror already created ones with simple copy paste techniques and changing variables here and there. Now, I messed up the student list form, one of the premade forms, so I can't fix it and am barred from creating new lists based of the premade student list. I don't know much about Access besides what I have done trying to emulate this template. This is the section of code that I believe is the problem, since it stops compiling. The problem is on line 15:
Code:
SearchBox.Text = ""
Code:
'------------------------------------------------------------
' SearchGo_Click
'
'------------------------------------------------------------
Private Sub SearchGo_Click()
On Error GoTo SearchGo_Click_Err
If (Eval("[Form]![SearchBox] Is Null Or [Form]![SearchBox]=""""")) Then
' Clear Filter when search box empty
DoCmd.ApplyFilter "", """""", ""
DoCmd.GoToControl "SearchBox"
DoCmd.SetProperty "SearchClear", acPropertyVisible, "0"
DoCmd.SetProperty "SearchGo", acPropertyVisible, "-1"
End If
If (Eval("[CurrentProject].[IsTrusted] And ([Form]![SearchBox] Is Null Or [Form]![SearchBox]="""")")) Then
SearchBox.Text = ""
End If
If (Eval("[Form]![SearchBox] Is Null Or [Form]![SearchBox]=""""")) Then
End
End If
If (VarType(Form!SearchBox) <> 8) Then
End
DoCmd.SetProperty "SearchGo", acPropertyVisible, "-1"
End If
If (Eval("([Form]![SearchBox] Is Null Or [Form]![SearchBox]="""") And [SearchClear].[Visible]<>0")) Then
DoCmd.SetProperty "SearchClear", acPropertyVisible, "0"
End
End If
' Handle "'s in search
TempVars.Add "strSearch", Replace(Form!SearchBox, """", """""")
' Build the Filter
TempVars.Add "strFilter", "([Last Name] Like "" * " & [TempVars]![strSearch] & " * "" )"
TempVars.Add "strFilter", TempVars!strFilter & " OR ([First Name] Like "" * " & [TempVars]![strSearch] & " * "" )"
If (Form.Name = "Guardian List") Then
TempVars.Add "strFilter", TempVars!strFilter & " OR ([Company] Like "" * " & [TempVars]![strSearch] & " * "" )"
End If
If (Form.Name = "Guardian List") Then
TempVars.Add "strFilter", TempVars!strFilter & " OR ([Job Title] Like "" * " & [TempVars]![strSearch] & " * "" )"
End If
TempVars.Add "strFilter", TempVars!strFilter & " OR ([E-mail Address] Like "" * " & [TempVars]![strSearch] & " * "" )"
If (Form.Name = "Student List") Then
TempVars.Add "strFilter", TempVars!strFilter & " OR ([Student ID] Like "" * " & [TempVars]![strSearch] & " * "" )"
End If
If (Form.Name = "Student List") Then
TempVars.Add "strFilter", TempVars!strFilter & " OR ([ID Number] Like "" * " & [TempVars]![strSearch] & " * "" )"
End If
TempVars.Add "strFilter", TempVars!strFilter & " OR ([Web Page] Like "" * " & [TempVars]![strSearch] & " * "" )"
TempVars.Add "strFilter", TempVars!strFilter & " OR ([Notes] Like "" * " & [TempVars]![strSearch] & " * "" )"
DoCmd.ApplyFilter "", TempVars!strFilter, ""
TempVars.Remove "strFilter"
TempVars.Remove "strSearch"
DoCmd.SetProperty "SearchClear", acPropertyVisible, "-1"
DoCmd.GoToControl "SearchBox"
DoCmd.SetProperty "SearchGo", acPropertyVisible, "-1"
SearchGo_Click_Exit:
Exit Sub
SearchGo_Click_Err:
MsgBox Error$
Resume SearchGo_Click_Exit
End Sub
Thanks for looking at my thread any help would be appreciated. I tried opening a new student database and copying all the code to "reset" everything, but I still get issues with the form when trying to use the search box inside the student list. I'm sure this sounds vague, and hard to help with, but I'll try to reply and clarify anything if need be. Thank you.