Strow bracht volgend idée uit :
What would be the best way to make your own personalized find button. i
want one that only searchs for either fname, lname, phone, or a
combination of the three. what is the bets way to go about this, hard
coding it and not using any sort of wizard. would really appreciate the
help
I would probably setup 3 unbound textboxes and a search-button. Then
perform a filter on the form with these values when the user clicks the
button.
You probably want to build the filter-string in code to check for
null-values (users didn't fill in a field) and perhaps to check for a
'no records found with these values'.
ButtonClickEvent:
Dim strSearch as string
strSearch = ""
if Nz(Me.txtfNameSeach,"") <> "" then
strSearch = "fname = '" & me.txtfNameSeach & "'"
endif
if Nz(Me.txtlNameSeach,"") <> "" then
if strSearch <> "" then
strSeach = strSeach & " AND "
endif
strSearch = strSearch & "flname = '" & me.txtlnamesearch & "'"
endif
if Nz(Me.txtphoneSeach,"") <> "" then
if strSearch <> "" then
strSeach = strSeach & " AND "
endif
strSearch = strSearch & "flname = '" & me.txtphonesearch & "'"
endif
if strSearch <> "" then
me.filter = strSearch
me.filteron = true
'To be honest, I'm not sure if the following will work, haven't tries
this beore...
if me.recordset.eof then
call msgbox("No records found with these criteria...",
vbinformation & vbokonly,"Search")
endif
else
'Nothing to search for, user didn't enter any values
endif