access 16, not able to type in the search box

aamyra

New member
Local time
Today, 02:31
Joined
Apr 28, 2022
Messages
8
Hi,
plz help, in form contact list, am not able to type anything in the search box and do a search.
Pack attached.
 

Attachments

The form's allow edits property is false. You can toggle that property in the focus events of the textbox.
 
thxs ive set it to true and now able to type. But when i click on the search btn
Getting "Type Mismatch".

Pls help.
 
Show your code. :( (within code tags </>)
I do not want to have to download, unzip and open a DB just to see a piece of what should be, simple code. :)
 
idk if u means this code..
in the button for search macros on click = Search.ClearFilter
In table the ID is auto number, First Name, Last name is short text.

Code:
if [CurrentProject].[IsTrusted] And ([Form]![SearchBox] Is Null Or [Form]![SearchBox]="")
Set value  -----> Here am getting an exclamation mark.. with unsafe action
item = [SearchBox].[Text]
Expression = ""

setTempVar
    Name     strFilter
    Expression = "([ID] Like ""*" & [TempVars]![strSearch] & "*"")"

setTempVar
    Name     strFilter
    Expression = [TempVars]![strFilter] & " OR ([First Name] Like ""*" & [TempVars]![strSearch] & "*"")"

setTempVar
    Name     strFilter
    Expression = [TempVars]![strFilter] & " OR ([Last Name] Like ""*" & [TempVars]![strSearch] & "*"")"
 
I tend to use ' for strings. I do not have many that will already have a ' in the control/variable.
Code:
    Expression = "[ID] Like "'*" & [TempVars]![strSearch] & "*'"
Otherwise I think it is three " or use CHR(34) ?

Normally I would say Debug.Print the variable, but as you are using macroes, not sure how you can do that. perhaps use Echo in the macro, or even MSGBOX ?
 

Users who are viewing this thread

Back
Top Bottom