Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB Databases
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 18th, 2005, 05:31 PM
Authorized User
 
Join Date: Dec 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default searcing multiple tables with any letter

hi. i have a problem. i need to be able to search multiple tables in ms access useing any letter of the field and thenfor it to display it in a list to be selected.

egsample; the user is looking for a company with the name "Fred Blogs" so he types in "ed" clicks search then brings back the results of all values with "ed" in it in a list for him to select the right one.

please help i am really stuck on this

Regards
Matthew Allee

Computer Consultant
R Charles Associates

 
Old January 19th, 2005, 01:03 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there..

you can use like in the where clause...

EX:

select * from anytable where field1 like "*ed*"

* inside the string means that can be any char (or a lot of them), you can use ? also to look for only one char.

HTH

Gonzalo
 
Old January 24th, 2005, 01:04 AM
Registered User
 
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Public Function Supervisor_Search(Grid As MSHFlexGrid, Field As String, KeyWord As String)

    SQL = "select * from tblSupervisor where " & Field & " like '" & KeyWord & "%' order by Supervisor_Lastname"
    rs.Open SQL, conn
    Set Grid.DataSource = rs
    rs.Close

End Function

the Field is the Field in your database, and the keyword are the one's you input in your text box. Hope it helps...

 
Old January 24th, 2005, 07:57 AM
Authorized User
 
Join Date: Dec 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

mac ware that sounds like great help thank you for your post. im not sure tho coz im creating the program in vb6 to look at the microsoft table. im sorry i wasent clear on that from start i am using what you wrote to see if i can change it into vb6
regards matthew allee






Similar Threads
Thread Thread Starter Forum Replies Last Post
Searching multiple tables melkin Classic ASP Databases 0 March 10th, 2008 11:48 AM
Desc on multiple tables azazael Oracle 2 March 28th, 2007 08:05 PM
Insert into Multiple Tables bmalex1 Beginning PHP 0 February 6th, 2006 12:45 PM
Importing Multiple files in Multiple tables Versi Suomi Access 6 June 1st, 2005 08:47 AM
Multiple Recordsets from Multiple Tables TSEROOGY Classic ASP Databases 2 December 28th, 2004 12:45 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.