473,624 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VBA function break string input for SQL string

I'm kind of looking for some guidance in respect of this obstacle I'm
up against - please let me expand;

I have an option group with three options (AND, OR, & NONE) and a text
box which will accept free text - the text will become criteria in a
SQL string and depending upon the option the WHERE clause will be
AND/OR LIKE textCriteria1 AND/OR LIKE textCriteria2.. ..

I'm trying to create a VBA function to take the free text and break up
the component words and return them back for use in the WHERE
clause.... and I'm stuck at this point!

I'm quite looking more guidance and pointers on this, rather than some
kindly person providing an elegant VBA code script.
I know what I'm doing after I've got the SQL string built, it's just
breaking the component words into an AND/OR string for the WHERE
clause.

As I say, any guidance would be appreciated.

Thanks in advance

Phil

Nov 8 '06 #1
4 2659
Well, you have to consider precedence:

Where (State = "FL" or State="AL") And SalesGuy = "JIM"

is different from:

Where State = "FL" or State="AL" And SalesGuy = "JIM"
I would almost think you'd be better off leaving a text box and let
them freeform type the where clause.
Chris Nebinger
Phil Latio wrote:
I'm kind of looking for some guidance in respect of this obstacle I'm
up against - please let me expand;

I have an option group with three options (AND, OR, & NONE) and a text
box which will accept free text - the text will become criteria in a
SQL string and depending upon the option the WHERE clause will be
AND/OR LIKE textCriteria1 AND/OR LIKE textCriteria2.. ..

I'm trying to create a VBA function to take the free text and break up
the component words and return them back for use in the WHERE
clause.... and I'm stuck at this point!

I'm quite looking more guidance and pointers on this, rather than some
kindly person providing an elegant VBA code script.
I know what I'm doing after I've got the SQL string built, it's just
breaking the component words into an AND/OR string for the WHERE
clause.

As I say, any guidance would be appreciated.

Thanks in advance

Phil
Nov 8 '06 #2
Hi Chris
Thanks for the quick response - good point about the precedence.
It's intended the criteria be applied to a single memo field, so I need
to think this through little.

Cheers

Phil

ch************@ gmail.com wrote:
Well, you have to consider precedence:

Where (State = "FL" or State="AL") And SalesGuy = "JIM"

is different from:

Where State = "FL" or State="AL" And SalesGuy = "JIM"
I would almost think you'd be better off leaving a text box and let
them freeform type the where clause.
Chris Nebinger
Phil Latio wrote:
I'm kind of looking for some guidance in respect of this obstacle I'm
up against - please let me expand;

I have an option group with three options (AND, OR, & NONE) and a text
box which will accept free text - the text will become criteria in a
SQL string and depending upon the option the WHERE clause will be
AND/OR LIKE textCriteria1 AND/OR LIKE textCriteria2.. ..

I'm trying to create a VBA function to take the free text and break up
the component words and return them back for use in the WHERE
clause.... and I'm stuck at this point!

I'm quite looking more guidance and pointers on this, rather than some
kindly person providing an elegant VBA code script.
I know what I'm doing after I've got the SQL string built, it's just
breaking the component words into an AND/OR string for the WHERE
clause.

As I say, any guidance would be appreciated.

Thanks in advance

Phil
Nov 8 '06 #3
"Phil Latio" <ph********@lyc os.co.ukwrote in
news:11******** *************@m 7g2000cwm.googl egroups.com:
Hi Chris
Thanks for the quick response - good point about the
precedence. It's intended the criteria be applied to a single
memo field, so I need to think this through little.

Cheers

Phil
I built a text search similar to what you want. Had 4 textboxes
one above the other labeled "enter keyword to find" with
3comboboxes containing blank; and;or;and not; between
the textboxes. all except the first textbox were not visible.

The first textbox's afterupdate event set the first combo's
..visible to true, the first combo's after update set the second
textbox's .visible to true, and so on. If any comboboxes had
differing connectives, A little modal form would pop up and
allow the user to option

(x and y) or z
x and (y or z)

created from "(x " & cbo1 &" y) " & cbo2 & " z"
"x " & cbo1 &" (y " & cbo2 & " z)" for three variables,

(W or x) and (y or z)
W or (x and y) or z
or
(W or x or y) and z
W or x or (y and z)

then some additional code built the Where clause.

Hope this gives you some ideas.

Q
ch************@ gmail.com wrote:
>Well, you have to consider precedence:

Where (State = "FL" or State="AL") And SalesGuy = "JIM"

is different from:

Where State = "FL" or State="AL" And SalesGuy = "JIM"
I would almost think you'd be better off leaving a text box
and let them freeform type the where clause.
Chris Nebinger
Phil Latio wrote:
I'm kind of looking for some guidance in respect of this
obstacle I'm up against - please let me expand;

I have an option group with three options (AND, OR, & NONE)
and a text box which will accept free text - the text will
become criteria in a SQL string and depending upon the
option the WHERE clause will be AND/OR LIKE textCriteria1
AND/OR LIKE textCriteria2.. ..

I'm trying to create a VBA function to take the free text
and break up the component words and return them back for
use in the WHERE clause.... and I'm stuck at this point!

I'm quite looking more guidance and pointers on this,
rather than some kindly person providing an elegant VBA
code script. I know what I'm doing after I've got the SQL
string built, it's just breaking the component words into
an AND/OR string for the WHERE clause.

As I say, any guidance would be appreciated.

Thanks in advance

Phil



--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Nov 9 '06 #4
Hi Bob,

Many thanks - that's certainly food for thought!

I'll ruminate on that, given the far greater flexibility it offers for
my search.

Cheers

Phil

Bob Quintal wrote:
"Phil Latio" <ph********@lyc os.co.ukwrote in
news:11******** *************@m 7g2000cwm.googl egroups.com:
Hi Chris
Thanks for the quick response - good point about the
precedence. It's intended the criteria be applied to a single
memo field, so I need to think this through little.

Cheers

Phil
I built a text search similar to what you want. Had 4 textboxes
one above the other labeled "enter keyword to find" with
3comboboxes containing blank; and;or;and not; between
the textboxes. all except the first textbox were not visible.

The first textbox's afterupdate event set the first combo's
.visible to true, the first combo's after update set the second
textbox's .visible to true, and so on. If any comboboxes had
differing connectives, A little modal form would pop up and
allow the user to option

(x and y) or z
x and (y or z)

created from "(x " & cbo1 &" y) " & cbo2 & " z"
"x " & cbo1 &" (y " & cbo2 & " z)" for three variables,

(W or x) and (y or z)
W or (x and y) or z
or
(W or x or y) and z
W or x or (y and z)

then some additional code built the Where clause.

Hope this gives you some ideas.

Q
ch************@ gmail.com wrote:
Well, you have to consider precedence:

Where (State = "FL" or State="AL") And SalesGuy = "JIM"

is different from:

Where State = "FL" or State="AL" And SalesGuy = "JIM"
I would almost think you'd be better off leaving a text box
and let them freeform type the where clause.
Chris Nebinger
Phil Latio wrote:
I'm kind of looking for some guidance in respect of this
obstacle I'm up against - please let me expand;

I have an option group with three options (AND, OR, & NONE)
and a text box which will accept free text - the text will
become criteria in a SQL string and depending upon the
option the WHERE clause will be AND/OR LIKE textCriteria1
AND/OR LIKE textCriteria2.. ..

I'm trying to create a VBA function to take the free text
and break up the component words and return them back for
use in the WHERE clause.... and I'm stuck at this point!

I'm quite looking more guidance and pointers on this,
rather than some kindly person providing an elegant VBA
code script. I know what I'm doing after I've got the SQL
string built, it's just breaking the component words into
an AND/OR string for the WHERE clause.

As I say, any guidance would be appreciated.

Thanks in advance

Phil

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com
Nov 9 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
6146
by: leegold2 | last post by:
I have been looking for a php word wrap function. I know there's an official PHP function but I've tried that and many of the functions contributed on that php.net page and none do what I want...and some act weird as well. I want, If I say break at 150 chars then the function will break at the nearest space to 150 ie. it will actually break at the word boundry. And if theres a url it will not break inside a URL, it will leave URLS alone....
1
2528
by: Foxy Kav | last post by:
Hi everyone, im a first year UNI student doing a programming subject and im stuck on how to get rid of my global variables, char stringarray and char emptystring. I was wondering if anyone could show me a example of how to do this. I was told to pass the arrays from function to function, but i do not know how .... Thanxs if you can help. My code (First two functions only - there's more):
4
2157
by: interpim | last post by:
ok the function is supposed to accept only non-negative integers... but it still accepts letters input through the function. Such as '23e' still passes through. I tried to use isalpha in the or statement to cause an error, but it causes an error for everything input. How do I make an error occur when anything other than numbers are put in? #include <stdio.h> #define MAXLINE 20 int main(void) { char line; int error,n; do{...
6
7606
by: karthi | last post by:
hi, I need user defined function that converts string to float in c. since the library function atof and strtod occupies large space in my processor memory I can't use it in my code. regards, Karthi
8
2681
by: ais523 | last post by:
I use this function that I wrote for inputting strings. It's meant to return a pointer to mallocated memory holding one input string, or 0 on error. (Personally, I prefer to use 0 to NULL when returning null pointers.) It looks pretty watertight to me, but my version of lint complains about use of deallocated pointers, etc. Is this code completely safe on all input, or have I missed something? /* Header files included in the program...
3
3641
by: Beta What | last post by:
Hello, I have a question about casting a function pointer. Say I want to make a generic module (say some ADT implementation) that requires a function pointer from the 'actual/other modules' that takes arguments of type (void *) because the ADT must be able to deal with any type of data. In my actual code, I will code the function to take arguments of their real types, then when I pass this pointer through an interface function, I...
2
10917
by: cryme | last post by:
Im having a minor, simple problem. Basicly i have two different scripts they both work separately and together but just that both executes at the same time. On my html page i have a form, one of the functions are that you can fill in the fields and when you press on a button you go to a new page, were all filled fields are shown. Now i want to validate the form before i pass on the filled information to the "next page". But right now...
4
2174
by: comp.lang.php | last post by:
Could someone please spot-check this function and tell me why it never, ever, pads an integer with a leading zero when I want it to? This function fails in PHP 4.3.8, 4.4.1 and 4.3.9 Thanx Phil f (!function_exists('pad')) {
5
2730
by: pbearne | last post by:
Hi guys I am trying to this function below I have a web form with a load of inputs text boxs etc and i need to disable them So I have tried to write a function I can call and get the function to work the type of the input so can disaable as needed
11
1771
by: Daniel T. | last post by:
The function below does exactly what I want it to (there is a main to test it as well.) However, I'm curious about ideas of making it better. Anyone interested in critiquing it? void formatText( const string& in, int charsPerLine, int lines, vector< string >& out ) { out.resize( 1 ); out = ""; int prev = 0;
0
8680
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8336
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8482
tracyyun
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...
0
7168
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, 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...
1
6111
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5565
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4082
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...
1
1791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1487
bsmnconsultancy
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.