473,434 Members | 1,354 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,434 software developers and data experts.

MS Access Query Criteria

If I type [Forms]![MData]![Cast] in my query criteria and query deals with its value which may be (Like "" & "Raj Poot" & "") Or (Like "" & "Malak" & ""). Is it Possible?

Actually, each of my clients has different demands (Criteria), so I want to type their demands in their forms field in VBA coding format. Such as (Like "" & "Raj Poot" & "") Or (Like "" & "Malak" & "")
Mar 29 '23 #1
1 12841
NeoPa
32,556 Expert Mod 16PB
I'm a little confused, but probably because you are too and questions often don't make much sense when the one asking is confused.

"Is it possible?" Almost anything is possible. What it refers to in this sense is beyond me.

Let me see if I can make some statements that are true and see if any help you at all.

(Like "" & "Raj Poot" & "") Or (Like "" & "Malak" & "") can be used as part of the criteria. It would be a very curious way to express the desire to match either "Raj Poot" or "Malak", but it would work.

Bear in mind though that while this may fit into the Criteria box in a Query (QueryDef object), it doesn't work directly in SQL. SQL format requires a match to be specified such that both sides of the comparison are stated. EG. [MyField] = 'X'. Just specifying "X" will not work.

"" & "X" & "" will result in exactly the same string as "X" so why would anyone in their right mind add the two useless empty strings. The only reason I can think of is that they copied something else and didn't understand what they were doing. This happens. It's not wrong. It's just not a great way to proceed. Where possible, it's advisable to understand what something does before trying to use it.

It also makes no sense to use Like "X" when the "X" string contains no wildcard characters. It's functionally equivalent to =. Thus, your filter code above could equally be written as ([MyField]='Raj Poot') Or ([MyField]='Malak') (Note the Quotes (') used are the appropriate ones for SQL). There's even another way which is better for comparing against a list of values - [MyField] In('Raj Poot','Malak').

If that doesn't answer your question then I'm afraid you'll have to write it in such a way that it makes actual sense.
Mar 29 '23 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: jen | last post by:
What is the correct syntax to reference a form field in a query. For example, I want to pull data where field x of my table equals field y on a form? Thanks in advance for the help!
2
by: mgolding | last post by:
I have an Access query that gets an ID value from an open form. Something like SELECT * from tablename WHERE ID=openFormName.ID; But now, I want to also run the query by handing it the ID from...
3
by: PCCTN | last post by:
I am trying to find out what criteria to put into a specific query that is connnected to a table field of part numbers. The problem is that it has some part numbers that are numbers and some part...
3
by: marylipscomb | last post by:
I am going over code that I am now responsible for but did not write. Can someone tell me what this means? Thank you so much Also this is on a query, criteria. Like "*" & !! & "*" What does...
2
by: Aussie Rules | last post by:
Hi, I have a access 2007 database with a cross tab query. Based on the selection critieria the cross tab may contain a different number columns in the result. For example if the query is...
5
by: erog | last post by:
Hello I've tried using the MS Access Northwind sample DB and I've downloaded a few other sample Microsoft Access DBs from their website. I keep on running into the same problem for trying to...
3
by: Shawn29316 | last post by:
I've read a hodgepodge of suggestions all over the internet for passing global variable info to Access queries but can't make it work for me. I'm using ACCESS 2010. I have a form with 3 subforms....
3
MitchR
by: MitchR | last post by:
Howdy Folks! I am working on a project where I have been given Domain\Usernames (Contoso\JSmith) and my data dump has records containing the Domain\ and no user name, Domain\administrator, and...
0
by: SteveQuist | last post by:
I have a form with a textbox txtSelectedCustomers that has the values: "ACE ", "CORN ", "DOVE " I am trying to use this textbox in as the selection criteria. If I use: In ("ACE ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.