Adding Command Button (1 Viewer)

Gretchen

Registered User.
Local time
Today, 20:33
Joined
Feb 25, 2002
Messages
48
I want to add a command button that will let the users look for a record by FirstName + Last Name at the same time. The name field is separated not all together. Also I want to lookk up the name as anything close. i.e. Sue, Susan, Susie, etc.

Say I want to find Sue Smith. I want the command button to let me put in Sue Smith and it will look for Sue Smith, Susie Smith, Susan Smith. I imagine it to be something like Su* Smith???

Anyway.... I can put the command button on the form, that's no problem. My problem is how do I get it to do what I want it to? I posted a question similar to this a while back and the only response I got was no help to me. So am trying once again as i know no where else to turn for help.

 

chewy

SuperNintendo Chalmers
Local time
Today, 20:33
Joined
Mar 8, 2002
Messages
581
I know this is on the forum somewhere but not sure where.

try this
 

Attachments

  • search for 97.zip
    10.6 KB · Views: 101

Shadez

Registered User.
Local time
Today, 20:33
Joined
Jan 20, 2003
Messages
192
hmm tricky (not realy)


How detailed do i need to go???

Use vba to create your find criteria

ie

dim firstname as string
dim Surname as string
dim findStr as string

firstname = mid(SearchTxt,1,instr(1,searchTxt," "))
surname = mid(searchtxt,instr(1,searchtxt," ")+1)

if surname <> "" then
findstr = "Firstname like '*" & firstname & "*' and Lastname like '*" & surname & "*'"
else
findstr = "Firstname like '*" & firstname & "*'
end if

me.filterOn = true
me.filter = findstr

me.refresh


i think that should do the job....

Note this example assumes u always enter a firstname and possible surname

:cool:ShadeZ:cool:
 

Gretchen

Registered User.
Local time
Today, 20:33
Joined
Feb 25, 2002
Messages
48
ok! I can copy and paste that into VB ... so how do I get to vb? and does it attach to the command button? (ok ok ... so I know practically nothing here ... go detailed man! detailed!) :p

I do appreciate the help .. truly I do!
 

Gretchen

Registered User.
Local time
Today, 20:33
Joined
Feb 25, 2002
Messages
48
Chewy, I read up on Dim statements but it doesn't explain to me what you were indicating with Dim dbNm As Database... running the module gives me an error as not defined... ??? My datbase name is MasterTest but it doesn't like that. I don't know what I'm doing here! *sigh* I need another class!!!

Was I supposed to put MasterCopy.First Name (my table name and first name field) in place of tblInfo.FName?

so confused ....

:confused:
 

chewy

SuperNintendo Chalmers
Local time
Today, 20:33
Joined
Mar 8, 2002
Messages
581
can you post your DB?
 

Gretchen

Registered User.
Local time
Today, 20:33
Joined
Feb 25, 2002
Messages
48
Post the dbase? What do you mean? Put the entire thing on here? It's huge! I could email it to you perhaps if you want to see it. (Gosh I hope I don't sound as stupid as I feel)

:rolleyes:
 

Users who are viewing this thread

Top Bottom