access 16, not able to type in the search box (1 Viewer)

aamyra

New member
Local time
Today, 01:04
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

  • test.zip
    494 KB · Views: 123

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 17:04
Joined
Aug 30, 2003
Messages
36,124
The form's allow edits property is false. You can toggle that property in the focus events of the textbox.
 

aamyra

New member
Local time
Today, 01:04
Joined
Apr 28, 2022
Messages
8
thxs ive set it to true and now able to type. But when i click on the search btn
Getting "Type Mismatch".

Pls help.
 

Gasman

Enthusiastic Amateur
Local time
Today, 01:04
Joined
Sep 21, 2011
Messages
14,238
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. :)
 

aamyra

New member
Local time
Today, 01:04
Joined
Apr 28, 2022
Messages
8
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] & "*"")"
 

Gasman

Enthusiastic Amateur
Local time
Today, 01:04
Joined
Sep 21, 2011
Messages
14,238
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

Top Bottom