•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 402,421 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,016 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 3273 | Replies: 5
![]() |
•
•
Join Date: Oct 2005
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
Hi there,
I have a system built in VB_6 professional which reads from an access database.
I need to search for a specific record using a word or short description entered by the user. This will link to the DESCRIPTION field in the database itself. Not being case sensitive would be a bonus.
Does anybody have any sample code for such a function? or does anybody know where i could find such code?
Many thanks
I have a system built in VB_6 professional which reads from an access database.
I need to search for a specific record using a word or short description entered by the user. This will link to the DESCRIPTION field in the database itself. Not being case sensitive would be a bonus.
Does anybody have any sample code for such a function? or does anybody know where i could find such code?
Many thanks
•
•
Join Date: Oct 2005
Posts: 25
Reputation:
Rep Power: 3
Solved Threads: 0
do it though your SQL query. I havent used an Access SQL query in years, but it might be similar to:
Then execute the query with searchText.
Dim searchText as String Dim sqlQuery as String searchText = searchDescription.Text sqlQuery = "SELECT * FROM `whatever_table` WHERE `description` LIKE `%" & searchText & "%' LIMIT 10;"
Then execute the query with searchText.
•
•
Join Date: Mar 2006
Location: Singapore
Posts: 50
Reputation:
Rep Power: 3
Solved Threads: 2
I believe Access does not have the
For case-insensitivity, first of all, I do not know if this function is available in VB because all I've used is VB.NET. Note the underlined portions:
When you set both the field you are matching with and the match text to lowercase (or uppercase), it is equivalent to a case-insensitive match, albeit the possible inefficiency of matching long strings of opposite-cased text.
You might want to take a look at this two posts for some issues related to this:
http://www.daniweb.com/techtalkforums/post200141-5.html
http://www.daniweb.com/techtalkforums/post200190-9.html
Hope this helps
LIMIT keyword, and that is only an extension specific to MySQL. MS SQL Server uses TOP but I don't think Access has this function. Also, Access and MS SQL Server uses square brackets ([]) to delimit its variable names, while MySQL uses the backtick (`). Other than these issues, the LIKE operator would settle your string searching needs.For case-insensitivity, first of all, I do not know if this function is available in VB because all I've used is VB.NET. Note the underlined portions:
Dim searchText as String Dim sqlQuery as String searchText = searchDescription.Text sqlQuery = "SELECT * FROM [whatever_table] WHERE TOLOWER([description]) LIKE `%" & searchText.ToLower() & "%';"
You might want to take a look at this two posts for some issues related to this:
http://www.daniweb.com/techtalkforums/post200141-5.html
http://www.daniweb.com/techtalkforums/post200190-9.html
Hope this helps
Best Regards, God Bless,
AstroNox
AstroNox
•
•
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation:
Rep Power: 7
Solved Threads: 107
Ok, this is a vb 4, 5, 6 forum, not a vb.net forum. Should you be looking for that forum, you can find it here: http://www.daniweb.com/techtalkforums/forum58.html. var.tolower() is a .net method, and is not available in vb6. Let's try to keep related information grouped in their respective forums.
•
•
Join Date: Mar 2006
Location: Singapore
Posts: 50
Reputation:
Rep Power: 3
Solved Threads: 2
I'm sorry but I didn't know that
ToLower() is a VB.NET specific function. You see, I've never programmed in VB4/5/6 before, but I had done VB.NET and VBA so I thought I might be able to share something useful. Just trying to help but I'll keep that in mind next time. Thanks! Best Regards, God Bless,
AstroNox
AstroNox
![]() |
•
•
•
•
•
•
•
•
DaniWeb Visual Basic 4 / 5 / 6 Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Writing to an Access Database (Visual Basic 4 / 5 / 6)
- Connecting password protected MS Access database from C# (C#)
- HELP: User Log In From Connected in Access Database (C#)
- Updating an Access database with a secondary form (VB.NET)
- how to write string to MS access database through DAO? (C)
- Registration and Login scripts using VB and Oledbconnection to Access Database (ASP.NET)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: nested joins, from mdb. Possible?
- Next Thread: How do I program a multi-menu application?



Linear Mode