473,386 Members | 1,743 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,386 software developers and data experts.

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 2642
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********@lycos.co.ukwrote in
news:11*********************@m7g2000cwm.googlegrou ps.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********@lycos.co.ukwrote in
news:11*********************@m7g2000cwm.googlegrou ps.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
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...
1
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...
4
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...
6
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,...
8
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...
3
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'...
2
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...
4
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...
5
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...
11
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(...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
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,...
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
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,...

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.