A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Using 'like' on a user prompt



 
 
Thread Tools Display Modes
  #1  
Old May 27th, 2010, 10:52 PM posted to microsoft.public.access.forms
RicDon
external usenet poster
 
Posts: 1
Default Using 'like' on a user prompt

I want to prompt the user for a value to use to filter a form. Here is my
command with the WhereCondition:

docmd.OpenForm "test", acNormal, , "LastName=[Enter a Last Name]"

I want to use the WhereCondition as a "LIKE" criteria. Variations on the
WhereCondition itself that I've tried include various combinations of

LastName LIKE %...%
LastName LIKE *...*
LastName LIKE [%...%]
LastName LIKE [*...*]

You get the idea...

No luck so far. Any thoughts?

  #2  
Old May 28th, 2010, 02:09 AM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Using 'like' on a user prompt

On Thu, 27 May 2010 21:52:50 GMT, "RicDon" u60397@uwe wrote:

I want to prompt the user for a value to use to filter a form. Here is my
command with the WhereCondition:

docmd.OpenForm "test", acNormal, , "LastName=[Enter a Last Name]"

I want to use the WhereCondition as a "LIKE" criteria. Variations on the
WhereCondition itself that I've tried include various combinations of

LastName LIKE %...%
LastName LIKE *...*
LastName LIKE [%...%]
LastName LIKE [*...*]

You get the idea...

No luck so far. Any thoughts?


LastName LIKE "*" & [Enter a last name, or part of one:] & "*"
--

John W. Vinson [MVP]
  #3  
Old May 28th, 2010, 02:14 AM posted to microsoft.public.access.forms
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Using 'like' on a user prompt

"RicDon" u60397@uwe wrote in message news:a8a6128a88ad8@uwe...
I want to prompt the user for a value to use to filter a form. Here is my
command with the WhereCondition:

docmd.OpenForm "test", acNormal, , "LastName=[Enter a Last Name]"

I want to use the WhereCondition as a "LIKE" criteria. Variations on the
WhereCondition itself that I've tried include various combinations of

LastName LIKE %...%
LastName LIKE *...*
LastName LIKE [%...%]
LastName LIKE [*...*]

You get the idea...

No luck so far. Any thoughts?



Try:

Docmd.OpenForm "test", acNormal, _
WhereCondition:="LastName Like '*' & [Enter a Last Name] & '*'"

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:01 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.