Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
To Check if First Word in One Text Field is Not Pr
MartinR 

13 years ago
The purpose of this is to check if a mistake (spelling or omission) has occurred between the two Fields and I therefore wish to show all such Records where there is a mistake. To check that the text in the whole of one (short) Field is somewhere in another Field I use either

WHERE hdscds.soloists AND InStr(hdscds.contents, hdscds.soloists)=false in a Query

Or

Me.Filter = "hdscds.soloists AND InStr(hdscds. contents, hdscds.soloists)=false"
Me.FilterOn = True

on a Form.

More generally this Filter string can be expressed as

MyTableMain.TextField1 AND InStr(MyTableMain.TextField2, MyTableMain.TextField1)=false

A Module that will isolate the first word in a text string is as follows:

Function FirstWordGet()

Dim FullString As String
Dim FirstWord As String

FullString = " Jack Smith Esq"

FullString = Trim(FullString) ' NOT REQUIRED IF there is no leading space in the FullString

' FullString = Screen.ActiveControl.Value ' Works IF an active control (text Field) is selected

FirstWord = Left(FullString, InStr(1, FullString, " ", vbTextCompare)) ' WORKS

MsgBox FirstWord ' Shows Jack

End Function

I assume that one way of approaching this would be to use a DAO recordset? I have never used one yet. I also understand that a Query can call a function? I am an early stage learner and have so far only used simple Filter strings.

Can anyone advise me about solving this seemingly simple problem using either Code on a Form, a Module, a Query or a combination of these?

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/15/2026 6:30:21 AM. PLT: 0s