Adding a search box to a form?? (1 Viewer)

alm5190

Registered User.
Local time
Today, 12:23
Joined
Mar 23, 2017
Messages
12
I am trying to place a search box in my form. I've tried a couple of different ways but I can't seem to get exactly what I am looking for. :banghead:

I want my users to be able to search 1 of 3 record identifiers. Once they click search the entire record is pulled up and the user can edit what is currently in the fields which will save back to the original table. :confused:

Any suggestions??
 

Ranman256

Well-known member
Local time
Today, 12:23
Joined
Apr 9, 2015
Messages
4,337
make a continous form, with all the data shown.
in the header put a text box for the user to enter a seach value, txtFind
add a combo for the user to pick 1 of 3 search columns.
and a find button to run the search.

user picks the field from the combo ,say City,
fills in the textbox, say "NY"
clicks Find button
the code in the find button will filter the list and show the results:

Code:
sub btnFind_click()
if  IsNull(me.txtFind) then
   me.filterOn = false
else
  me.filter = "[" & cboFld & "]='" & txtFind & "'"
   me.filterOn = true
endif
end sub
 

alm5190

Registered User.
Local time
Today, 12:23
Joined
Mar 23, 2017
Messages
12
Thanks so much!!

it works great for 2 of the fields. If I try to search the Primary Key I get an error. I'm assuming because this is an auto number. Is there a way around this??
 

Users who are viewing this thread

Top Bottom