ms-access


I keep on getting an error 13 type mismatch error, How can I get it out?


In Access 2010 I am trying to create a search box for a table of contacts on a form.
Here is my code:
Private Sub Command119_Click()
On Error GoTo Command119_Click_Err
If (Eval("[Forms]![frmTitlePage]![SearchBox] Is Null")) Then
' Clear Filter when search box empty
DoCmd.RunCommand acCmdRemoveFilterSort
End If
' Handle "'s in search
TempVars.Add "strSearch", Replace(Forms!frmTitlePage!SearchBox, """", """""")
' Build the Filter
TempVars.Add "strFilter", "([Last Name] Like "" * " & [TempVars]![strSearch] & " * "" )"
TempVars.Add "strFilter", TempVars!strFilter & " OR ([First Name] Like "" * " & [TempVars]![strSearch] & " * "" )"
DoCmd.ApplyFilter "", TempVars!strFilter, ""
TempVars.Remove "strFilter"
TempVars.Remove "strSearch"
Command119_Click_Exit:
Exit Sub
Command119_Click_Err:
MsgBox Error$
Resume Command119_Click_Exit
End Sub
I am obviously horrible at this coding so any additional help to clean this search tool up would help tremendously.
You have some extra spaces in your search
Your original code produced Like " * Smith * "
remove the extra spaces around the place you add [TempVars]![strSearch] to produce this:
TempVars.Add "strFilter", "([Last Name] Like ""*" & [TempVars]![strSearch] & "*"" )"
TempVars.Add "strFilter", TempVars!strFilter & " OR ([First Name] Like ""*" & [TempVars]![strSearch] & "*"" )"
should now produce Like "*Smith*"

Related Links

trying to filter subform based on contents of field on main form
How to use MS access on a server where MS Office is not installed
How do i import and eliminate first two row of website in msaccess while importing html pages
Multi criteria dlookup issue
Count all checkboxes in ms-access form…what am I doing wrong?
How do I set a default selection to a Listbox in MS Access
Microsoft Access not overwriting when exporting a query to excel
Using ms-access command-line tag /x but database opens read-only
Criteria with TempVars - but prompt user if tempvars is null
Crazy Cursor in TextBox on Table from ODBC database
Count of dates “This Month” to appear in a text box in Access Report
Issue with Removing References in Microsoft Access
Turn Access to Application
Powerpivot + Access + SSAS Cube
How to make the input dates which user type in the prompt show in report ? MS Access 2013
Access 2016 create table with field properties for combobox

Categories

HOME
twitter
wso2-am
react-virtualized
hashmap
react-router
twitter-bootstrap-4
jgroups
onelogin
networkx
upload
autotools
u-sql
iolanguage
worldwind
dosgi
openrefine
facebook-page
contextmenu
alpine
java-3d
opencover
physics-engine
mps
google-search-api
claims-based-identity
xpages-ssjs
numerical-methods
url-scheme
bootstrap-material-design
log4js-node
c++-amp
microsoft-chart-controls
tinymce-4
http-status-code-503
ioio
google-qpx-express-api
xmlreader
normal-distribution
jmonkeyengine
vxworks
simplexml
mixture-model
twitch
vapor
azure-ml
preconditions
janrain
http-redirect
hibernate-tools
apache-fop
react-scripts
veracode
darcs
diagnostics
r-forge
gcsfuse
spring-mongodb
eventkit
simplewebrtc
make-install
asp.net5
uid
cyclomatic-complexity
key-management
dia
block-device
angularjs-ng-click
html-helper
eol
valuechangelistener
page-layout
c18
farseer
access-rights
tidy
mylyn
delphi-6
free-variable
mhtml
broken-links
venn-diagram
onsubmit
stage
data-loss
yui-datatable
createwindow
suppress
nsviewanimation
sef
ctp4
privilege
sustainable-pace
data-acquisition
signal-handling
windows-live-messenger
ntvdm.exe

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App