how is this example work, textbox search (1 Viewer)

woody

Registered User.
Local time
Today, 04:47
Joined
Jan 26, 2011
Messages
23
hello ,
please anyone can see this example and explain for us how its work,
if i want make another one with different form and table name,

Thanks ,
 

Attachments

  • Contacts.zip
    40.1 KB · Views: 146

CBrighton

Surfing while working...
Local time
Today, 12:47
Joined
Nov 9, 2010
Messages
1,012
If you can attach a copy in 2003 format I'll have a look when I get back from lunch.
 

woody

Registered User.
Local time
Today, 04:47
Joined
Jan 26, 2011
Messages
23
Here is 2003,
 

Attachments

  • Contacts.zip
    27.7 KB · Views: 124

David Eagar

Registered User.
Local time
Today, 21:47
Joined
Jul 2, 2007
Messages
924
You could try something like this
 

Attachments

  • Contacts2.zip
    54.7 KB · Views: 139

CBrighton

Surfing while working...
Local time
Today, 12:47
Joined
Nov 9, 2010
Messages
1,012
Not sure if this is the same solution as above since that is an accdb file, but here's a possible solution using the filter property.
 

Attachments

  • Contacts.mdb
    420 KB · Views: 123

woody

Registered User.
Local time
Today, 04:47
Joined
Jan 26, 2011
Messages
23
I just complete my simple program.. but i have problem in forms
Contacts list
Follow-up
in QuickSearch . please anyone can fix that..i need it really fixed,

Thanks a lot.
 

Attachments

  • System_Backup.zip
    264.7 KB · Views: 120

woody

Registered User.
Local time
Today, 04:47
Joined
Jan 26, 2011
Messages
23
oh... here is 2003 , but why u still use old version..??
 

Attachments

  • System_Backup2003.mdb
    832 KB · Views: 115

CBrighton

Surfing while working...
Local time
Today, 12:47
Joined
Nov 9, 2010
Messages
1,012
I'll have a look now.

I use 2003 because that's what the business uses. Given that we have over 700 computers in this building alone it's a significant cost to update them all and updating just mine would be pointless as I would have to save it as a 2003 file anyway for the end users.

Besides, I'm just a database developer, I don't control the financial budget. :)
 

woody

Registered User.
Local time
Today, 04:47
Joined
Jan 26, 2011
Messages
23
Thank u dear, i hope u can help me to fix that QuickSearch .

Thanks
 

CBrighton

Surfing while working...
Local time
Today, 12:47
Joined
Nov 9, 2010
Messages
1,012
The same code provided in the example should work here.

What field should the search textbox search on?
 

woody

Registered User.
Local time
Today, 04:47
Joined
Jan 26, 2011
Messages
23
In Customers list its working fine.

You can see the Macro , in Follow-up form

SetTempVar strFilter, "([Place of Installation] Like ""*" & [TempVars]![strSearch] & "*"")"
SetTempVar strFilter, [TempVars]![strFilter] & " OR ([Customer Name] Like ""*" & [TempVars]![strSearch] & "*"")"
SetTempVar strFilter, [TempVars]![strFilter] & " OR ([Company Name] Like ""*" & [TempVars]![strSearch] & "*"")"
SetTempVar strFilter, [TempVars]![strFilter] & " OR ([Phone Number] Like ""*" & [TempVars]![strSearch] & "*"")"
 

CBrighton

Surfing while working...
Local time
Today, 12:47
Joined
Nov 9, 2010
Messages
1,012
Right, I've done it on the follow up form. I removed the filter property in the form properties window so that it starts without a filter. Other than that it's just the VBA behind the search & show all record buttons.

However, I want you to look at the code and update the contacts form yourself. I've shown you how it works now you need to start doing it for yourself so you remember it. :)
 

Attachments

  • System_Backup2003.zip
    217.9 KB · Views: 130

woody

Registered User.
Local time
Today, 04:47
Joined
Jan 26, 2011
Messages
23
Hi , u mean u add this code
Dim strFilter As String

If Not IsNull(SearchBox) Then
Me.FilterOn = True
strFilter = "[Place of Installation] Like ""*" & SearchBox & "*"" "
strFilter = strFilter & " OR [Customer Name] Like ""*" & SearchBox & "*"" "
strFilter = strFilter & " OR [Company Name] Like ""*" & SearchBox & "*"" "
strFilter = strFilter & " OR [Phone Number] Like ""*" & SearchBox & "*"" "
Me.Filter = strFilter
cmdShowAll.Enabled = True
End If
 

woody

Registered User.
Local time
Today, 04:47
Joined
Jan 26, 2011
Messages
23
and this in showall button


Me.Filter = ""
Me.FilterOn = False
cmdShowAll.Enabled = False
 

woody

Registered User.
Local time
Today, 04:47
Joined
Jan 26, 2011
Messages
23
But.. there is still problem.. if you open Follow-up , or Contacts list alone,,
and try to make Search its asking about Customers List form...
 

CBrighton

Surfing while working...
Local time
Today, 12:47
Joined
Nov 9, 2010
Messages
1,012
That and:
Code:
Private Sub cmdShowAll_Click()
Me.Filter = ""
Me.FilterOn = False
cmdShowAll.Enabled = False
End Sub

This piece of code cancels the filter and disables the show all records button again.

Note that the filter code (which you just quoted) checks to ensure the field isn't null but does not have an Else to explain what to do if the button is clicked and it is null. Not sure how you want to handle that, I'd likely use a MsgBox to tell the user to input something to search for.
 

CBrighton

Surfing while working...
Local time
Today, 12:47
Joined
Nov 9, 2010
Messages
1,012
Works fine for me when I open the follow up form without anything else open (other than the fact that you have images embedded which I do not have).
 

woody

Registered User.
Local time
Today, 04:47
Joined
Jan 26, 2011
Messages
23
Hi Again... i do it... but there is small problem...
when i insert text in text box to search i need to double-click on Search button.


why.?
 

Users who are viewing this thread

Top Bottom