find button ?

what should i write behind a find button, in order for me to build a find function. i use inputbox for input. the text i key in will be bound to database with id. the problem is what should i write in order for me to get the id and find the correct information and display in the form.
Who is Participating?
simonbennettConnect With a Mentor Commented:

Form is called frmFrom
Table is called Country
We are searching the CountryName field for the value typed in
The form is bound using a datacontrol called Data1

public sub cmdSearch_onclick()

 dim strData as string
 strData = inputbox("Which country?")
 if len(strdata)<1 then
  msgbox "You must enter data!
  exit sub

 frmform.data1.recordset.findfirst("CountryName = '" & trim(strdata) & "'")
 if frmform.data1.recordset.nomatch then
  msgbox "Data '" & strdata & "' not found."
 end if
end sub


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.