Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA 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 29th, 2007, 08:27 AM
Authorized User
 
Join Date: Jul 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Function to find if a letter is in a word

Hi,

I'm trying to find a function that will return a boolean value showing whether a specific letter appears in a word.

I have a list of thousands of words, and I've created a parameter query asking what letter is being searched for. I want to return all words in the list that contain that letter, but can't see how. I've been looking at InStr, but that's not it.

TIA for any help,
J.

 
Old January 29th, 2007, 10:05 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

InStr() IS what you are looking for. It will return a number (the position of the letter in the string) or 0 if the letter is not in the string, so use this as your Boolean:

If result = 0 = False
If result <> 0 = True

Did that work?

mmcdonal
 
Old January 29th, 2007, 05:44 PM
Authorized User
 
Join Date: Jul 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Aha - thanks a lot, mmcdonal, it's working fine now! I was using it wrong, putting in criteria that messed it up.

Cheers,
J.






Similar Threads
Thread Thread Starter Forum Replies Last Post
using Word Function melvik C# 0 September 5th, 2005 01:07 AM
Open Word Doc from Access - find, find next save donaldmaloney Access VBA 1 May 25th, 2005 11:09 AM
Function to Find a Record me2357 Access VBA 5 March 10th, 2005 03:22 PM
Find a Particular Word PanzarPaw Classic ASP Basics 3 November 14th, 2003 10:58 AM





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