I need to create a simple text box with a search button (1 Viewer)

Caquibf

New member
Local time
Today, 05:28
Joined
Apr 29, 2021
Messages
4
I have a simple database in access and would like to have a form with a simple text box and a search button (referring to 1 field only) "IDT". When I press search, the corresponding registry to the "IDT" field entered should appear.

I need it to find the exact match. Meaning it shouldn´t search everytime I type nor show the narrowing of the search, only the exact one after pressing search. (There is only 1 exact matching field always).

I hope it´s not too pretentious.
I'm attaching the model db.
 

Attachments

  • DSearch.accdb
    380 KB · Views: 197

Isaac

Lifelong Learner
Local time
Today, 01:28
Joined
Mar 14, 2017
Messages
8,774
I don't usually open other people's files, but we should be able to provide precise instructions that you can easily follow.
You can do something as simple as this in the textbox's Exit event:

Code:
Me.Recordsource="select * from table where IDT=" & me.TextboxName.Value
Me.Requery
or
Code:
Me.Recordsource="select * from table where IDT='" & me.TextboxName.Value & "'"
Me.Requery
(first one if IDT is numeric, second one if IDT is text)

And train your users to type in the box, then hit Tab to exit it.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:28
Joined
May 7, 2009
Messages
19,226
i open all, including yours.
 

Attachments

  • DSearch.accdb
    728 KB · Views: 184

Caquibf

New member
Local time
Today, 05:28
Joined
Apr 29, 2021
Messages
4
I don't usually open other people's files, but we should be able to provide precise instructions that you can easily follow.
You can do something as simple as this in the textbox's Exit event:

Code:
Me.Recordsource="select * from table where IDT=" & me.TextboxName.Value
Me.Requery
or
Code:
Me.Recordsource="select * from table where IDT='" & me.TextboxName.Value & "'"
Me.Requery
(first one if IDT is numeric, second one if IDT is text)

And train your users to type in the box, then hit Tab to exit it.
Thanks. I'm trying to get used to code but that was useful!
 

Gasman

Enthusiastic Amateur
Local time
Today, 09:28
Joined
Sep 21, 2011
Messages
14,216
I don't usually open other people's files, but we should be able to provide precise instructions that you can easily follow.
You can do something as simple as this in the textbox's Exit event:

Code:
Me.Recordsource="select * from table where IDT=" & me.TextboxName.Value
Me.Requery
or
Code:
Me.Recordsource="select * from table where IDT='" & me.TextboxName.Value & "'"
Me.Requery
(first one if IDT is numeric, second one if IDT is text)

And train your users to type in the box, then hit Tab to exit it.
No need for requery if recordsource changed?
 

Isaac

Lifelong Learner
Local time
Today, 01:28
Joined
Mar 14, 2017
Messages
8,774
Thanks. I'm trying to get used to code but that was useful!
Glad it helped - good luck!

No need for requery if recordsource changed?

I hear that a lot, but don't follow it, personally. I always want to make sure I'm seeing the most recent data, in addition to changing the recordsource, since often the button to change the recordsource is used after also changing data.
 

Users who are viewing this thread

Top Bottom