search box with if statement

H

harleyken

When I use the following code in 2007 with Vista, all works (even though I
have to hit the enter key after the click)...the file is saved in 2000
format, and when I try to use it in 2003 with XP, I get an error.

is there a way to make this work on click event w/o hitting the enter key on
both platforms?

Private Sub Command34_Click()
Me.Filter = "[pers_number] Like " & "'*" & Me![Text7] & "*'"
Me.FilterOn = True
If Me.Pers_Number = "0" Then
'SHOW "PERSONNELL NOT FOUND - LABEL13 AND ADD BUTTON
Me![Label13].Visible = True
Me.Command14.Visible = True
Me.Command14.SetFocus
'HIDE EVERYTHING ELSE
Me.[Text17].Visible = False
Me.[Text20].Visible = False
Me.[Text22].Visible = False

Me.Deputy.Visible = False
Me.Pers_Number.Visible = False

Me![Label21].Visible = False
Me![Label23].Visible = False
Me![Label24].Visible = False
Me![Label28].Visible = False
Me![Label32].Visible = False

Me![Command19].Visible = False
Me![Command26].Visible = False

Else
Me![Text17].Visible = True
Me![Label24].Visible = True
Me![Command19].Visible = True
Me.Command19.SetFocus
Me.Command34.Visible = False

End If
 
H

harleyken

clarification/add on to earlier post -

when record is found, I want to show the name with the option of using a
command button to be able to edit it for spelling etc

if the record is not found, I want to show different labels and be able to
add the name..

I have replaced the "0" with "null" with the same results.

I suppose the first question should be "is this even the right approach?"

thanks to those who take time to consider my problem!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top