473,734 Members | 2,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need Help With the Instr Function

1 New Member
I am trying to use the Instr function to find all six possible combinations of 123, 213,213,312 and 321 using this sql script:
Expand|Select|Wrap|Line Numbers
  1. SELECT WaltLottery.DTE AS TargetDates, WaltLottery.Cash3eve, WaltLottery.Cash3nite
  2. FROM WaltLottery
  3. WHERE (((WaltLottery.Cash3mid)=InStr([Enter###s: Separated by Commas],[Cash3mid])));
I get no data outputted and no syntax error.
but when I run the near identical script:
Expand|Select|Wrap|Line Numbers
  1. SELECT WaltLottery.DTE AS TargetDates, WaltLottery.Cash3eve, WaltLottery.Cash3nite
  2. FROM WaltLottery
  3. WHERE (((WaltLottery.Cash3mid)=[3###;])) OR (((WaltLottery.Cash3eve)=[3###;])) OR (((WaltLottery.Cash3nite)=[3###;]));
I get the desired output from each field. Both scripts are nearing identical.

Is there something that I am missing in the Instr function, (I have never used the Instr function. Need help please!
Sep 7 '18 #1
2 946
Seth Schrock
2,965 Recognized Expert Specialist
The InStr() function returns an integer value for the starting location of the string found, not the string itself.

Now that you have a working query, are you still needing help with the overall solution and just wondering about the InStr() function, or do you still need help with the query?
Sep 7 '18 #2
32,569 Recognized Expert Moderator MVP
This is a very strange question. Quite apart from the fact that the function is being misused, as explained by Seth, there are almost countless differences between the WHERE clauses of the two versions. How this appears to you as even remotely similar is quite beyond me - and I actually understand what each is doing.

If what you're after is to check each of three fields from your data against a string entered by the operator to ensure there's at least one match, and you want to write it succinctly, then you could try turning the check around and using the IN() function :
Expand|Select|Wrap|Line Numbers
  1. WHERE ([Enter value here] IN([Cash3mid],[Cash3eve],[Cash3nite]));
Sep 7 '18 #3

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

Similar topics

by: Icaro | last post by:
Hi everybody, I was looking for an equivalent ORACLE INSTR Function in MSSQL but I don´t found it and I don´t know if it exist so I must to write it and this is the code. Maybe it will be helful to you: /*************************************************************************** Description: Looks for a string inside another string and returns an integer that correspond to the position of first ocurrence.
by: deko | last post by:
I store hyperlinks as text in a table like this: Invoice11-21-2003.pdf#file://P:\Finance\PrefVendors\Receipts\Invoice11-21-20 03.pdf I need to run a report that lists the documents - or whatever the display text of the hyperlink is. As it is now, the entire hyperlink appears in the report - I'm trying to display just the document name.
by: Jim | last post by:
Need help with aggregate function...for each unique product, I need the provider with the cheapest cost factor Here't the table (Table1) ID product provider factor 1 123456 abc .050 2 123456 def .035 3 666666 def .040 4 123456 ghi .080
by: Andy_Khosravi | last post by:
Hello, I'm having a problem with the MID function within Access 97. I have been trying to build a function to check to make sure that a field on a form does not have any spaces or dashes. This should be easy enough to do using the MID function in a For...Next statement. However, I've had more than a few problems. My first problem was that I had a data type mismatch. Access simply refused to evaluate anything I put in there no matter...
by: Srinivasa Ra via .NET 247 | last post by:
(Type your message here) I am writing an application that does lot of read/write's withcomputer's serial port. The application as a whole is workingfine. Current Approach: I have a Timer that checks once every millisecond to see if there is any data avaialable to read at theserial port. If so then reads it. The serial port is openedwithout OVERLAPPING. TRYING TO GET TO: I don't think polling serial port every millisecond is a good approach....
by: lovecreatesbea... | last post by:
K&R 2, sec. 5.11 says that no need to precede function and array names with address-of operators &, why?
by: joestevens232 | last post by:
Ok everything is good...I read in all my grades into each of the different arrays that they need to go in. Now Im trying to write a function that takes the grades and computes the average on a hundred point scale...for example: Student 1 7 quiz scores 9 9.33 8 10 5.5 8 10 ==> the 5.5 score should be dropped, returned value: 90.55 6 project scores 20 47.5 47 45 47.5 48 ==> returned value: 94.44 2 exam scores 83 87 ==>...
by: hirsh.dan | last post by:
i have a functions that writes information to a file. inside that function i have a line in which i call another function. if this line is executed, nothing is written to the file, but if i remark that line, it is written. i wanna understand what's wrong and fix it, but can't find what is wrong. also this line is mandatory in my code. the code attached is in the link, minimized to the needed info, a bit different then the way it's...
by: =?Utf-8?B?UGF1bA==?= | last post by:
Just wondering if there is a way to cause a post back with a javascript function? Thanks. -- Paul G Software engineer.
by: kini113 | last post by:
I'm trying to split a text field ex: (10.00" od x 7.50" id) into 2 fields putting everything before the "x" into one column and everything after into another. I was able to achieve that using the Left() and Mid() functions. But I've run into a problem not all of the fields have an "x" some just have one dimension ex: (3.50" od) and the Mid() function returns that into the 2nd column, I need that 2nd column to be Null if there is no "x". This is...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.