473,289 Members | 1,929 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,289 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 12821
NeoPa
32,554 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 ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.