473,783 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

select problems

strSearch is a dynamically created search string

Copy of select statement below

sql = "SELECT
Master.Master_K ey,Master.First _App,Original_I nfo_Date,Last_I nfo_Date,Area.A r
ea_Name
AS Area_Name, State_Cntry.Sta te_Cntry_Name, Company.Oper_Na me1 AS
Oper_Name1, Company.Oper_Na me2 AS Oper_Name2, " _
& " Company.Oper_Na me3 AS Oper_Name3, Location.City AS City,
Projects.Projec t_Name AS Project_Name, " _
& " Expansion.Expan sion_Code AS Expansion_Code,
Master.Cap_Size AS cap_size, Cap.Cap_Unit AS Cap_Unit, Master.Cost AS
Cost, " _
& " Master.Status AS Status, Master.Estimate d_Year_Complete d
AS Estimated_Year_ Completed " _
& " FROM Master INNER JOIN " _
& " Area ON Master.Area_Key = Area.Area_Key INNER JOIN " _
& " Company ON Master.Company_ Key = Company.Company _Key INNER
JOIN " _
& " Location ON Master.Location _Key = Location.Locati on_Key
INNER JOIN " _
& " Expansion ON Master.Expansio n_Key =
Expansion.Expan sion_Key INNER JOIN " _
& " Cap ON Master.Cap_Key = Cap.Cap_Key INNER JOIN " _
& " Projects ON Master.Project_ Key = Projects.Projec t_Key
INNER JOIN " _
& " State_Cntry ON Location.State_ Cntry_Key =
State_Cntry.Sta te_Cntry_Key " _
& " WHERE " & strSearch _
& " ORDER BY Area.Area_Key, State_Cntry_Nam e,Oper_Name1,Ci ty"
The table I need to access is called LEC

LEC_Key (PK)
Master_Key - Database Master Key
Company_Key - matches the company
LEC_Type_Key - 3 types per company (values L,E or C)

Each Master Key will have 3 values in the table, one each of L,E and C

Hope this makes some sort of sense

Thanks in advance

Simon Christie

Jul 20 '05 #1
2 1697
"steve stevo" <st***@stevoste ve.fsnet.co.uk> wrote in message news:<bn******* ***@news6.svr.p ol.co.uk>...
strSearch is a dynamically created search string

Copy of select statement below

sql = "SELECT
Master.Master_K ey,Master.First _App,Original_I nfo_Date,Last_I nfo_Date,Area.A r
ea_Name
AS Area_Name, State_Cntry.Sta te_Cntry_Name, Company.Oper_Na me1 AS
Oper_Name1, Company.Oper_Na me2 AS Oper_Name2, " _
& " Company.Oper_Na me3 AS Oper_Name3, Location.City AS City,
Projects.Projec t_Name AS Project_Name, " _
& " Expansion.Expan sion_Code AS Expansion_Code,
Master.Cap_Size AS cap_size, Cap.Cap_Unit AS Cap_Unit, Master.Cost AS
Cost, " _
& " Master.Status AS Status, Master.Estimate d_Year_Complete d
AS Estimated_Year_ Completed " _
& " FROM Master INNER JOIN " _
& " Area ON Master.Area_Key = Area.Area_Key INNER JOIN " _
& " Company ON Master.Company_ Key = Company.Company _Key INNER
JOIN " _
& " Location ON Master.Location _Key = Location.Locati on_Key
INNER JOIN " _
& " Expansion ON Master.Expansio n_Key =
Expansion.Expan sion_Key INNER JOIN " _
& " Cap ON Master.Cap_Key = Cap.Cap_Key INNER JOIN " _
& " Projects ON Master.Project_ Key = Projects.Projec t_Key
INNER JOIN " _
& " State_Cntry ON Location.State_ Cntry_Key =
State_Cntry.Sta te_Cntry_Key " _
& " WHERE " & strSearch _
& " ORDER BY Area.Area_Key, State_Cntry_Nam e,Oper_Name1,Ci ty"
The table I need to access is called LEC

LEC_Key (PK)
Master_Key - Database Master Key
Company_Key - matches the company
LEC_Type_Key - 3 types per company (values L,E or C)

Each Master Key will have 3 values in the table, one each of L,E and C

Hope this makes some sort of sense

Thanks in advance

Simon Christie


What is your actual question/problem? By the way, you'll probably get
a better response if your SQL is just SQL, with no VB or other
language around it - that makes it a lot easier to read. Including
CREATE TABLE statements for the relevant tables is also considered
helpful.

Simon
Jul 20 '05 #2
Hi

Hope this makes some sort of sense

Unfortunately it doesn't! Although you have posted pseudo DDL for your
LEC table it is better to use the scripting options in Enterprise
Manager or Query Analyser to produce actual Create table statements.
Example data as insert statements for each table would be useful,
along with the expected output you require from that data.

Regarding the SELECT statement, it would make it shorter and easier to
read if you used table aliases and removed the unnecessary column
aliases. Not all you columns are pre-fixed with the table name which
could cause you problems.

HTH

John
"steve stevo" <st***@stevoste ve.fsnet.co.uk> wrote in message news:<bn******* ***@news6.svr.p ol.co.uk>... strSearch is a dynamically created search string

Copy of select statement below

sql = "SELECT
Master.Master_K ey,Master.First _App,Original_I nfo_Date,Last_I nfo_Date,Area.A r
ea_Name
AS Area_Name, State_Cntry.Sta te_Cntry_Name, Company.Oper_Na me1 AS
Oper_Name1, Company.Oper_Na me2 AS Oper_Name2, " _
& " Company.Oper_Na me3 AS Oper_Name3, Location.City AS City,
Projects.Projec t_Name AS Project_Name, " _
& " Expansion.Expan sion_Code AS Expansion_Code,
Master.Cap_Size AS cap_size, Cap.Cap_Unit AS Cap_Unit, Master.Cost AS
Cost, " _
& " Master.Status AS Status, Master.Estimate d_Year_Complete d
AS Estimated_Year_ Completed " _
& " FROM Master INNER JOIN " _
& " Area ON Master.Area_Key = Area.Area_Key INNER JOIN " _
& " Company ON Master.Company_ Key = Company.Company _Key INNER
JOIN " _
& " Location ON Master.Location _Key = Location.Locati on_Key
INNER JOIN " _
& " Expansion ON Master.Expansio n_Key =
Expansion.Expan sion_Key INNER JOIN " _
& " Cap ON Master.Cap_Key = Cap.Cap_Key INNER JOIN " _
& " Projects ON Master.Project_ Key = Projects.Projec t_Key
INNER JOIN " _
& " State_Cntry ON Location.State_ Cntry_Key =
State_Cntry.Sta te_Cntry_Key " _
& " WHERE " & strSearch _
& " ORDER BY Area.Area_Key, State_Cntry_Nam e,Oper_Name1,Ci ty"
The table I need to access is called LEC

LEC_Key (PK)
Master_Key - Database Master Key
Company_Key - matches the company
LEC_Type_Key - 3 types per company (values L,E or C)

Each Master Key will have 3 values in the table, one each of L,E and C

Hope this makes some sort of sense

Thanks in advance

Simon Christie

Jul 20 '05 #3

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

Similar topics

12
6558
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the courses to pass the correct option value and then be displayed at the following URL: http://www.dslextreme.com/users/kevinlyons/selectResults.html I am passing countries, products, and courses. The first two display
7
47426
by: lawrence | last post by:
Can I do something like the following to get a browser to redirect to a new url every time someone picks a new value in a select box? function changeUrl() { var redirect; redirect = document.getElementById('newUrl').value;
4
3867
by: Marek Mänd | last post by:
This seems an IE issue only: 4253 bytes testcase: http://www.hot.ee/idaliiga/testcases/ieselect/bnlinkingselectinmsie.htm Can one have 1) a mouseover/mouseout element on TBODY 2) change in thoise event handler background colors 3) have a specified heighted SELECT element, that doesnt flicker when the event handlers are get called.
4
6137
by: Bart van Deenen | last post by:
Hi all I have a script where I dynamically create multiple inputs and selects from a script. The inputs and selects must have an associated onchange handler. I have the script working fine on Firefox, Safari and Konqueror, but the onchange event just doesn't fire on IE6. Firefox's javascript console shows no errors, and the IE script debugger shows nothing. onchange is not triggered.
6
3032
by: Sjaakie | last post by:
Hi there, I'm trying to get this working with Firefox. Can you point out what's wrong? No problems with IE, Firefox doens't fill selMonth... TIA >>> the script... >>> <select name="selDay" id="selDay" style="width:50;" ></select> - <select name="selMonth" id="selMonth" style="width:50;"></select> -
10
5639
by: serge | last post by:
Using "SELECT * " is a bad practice even when using a VIEW instead of a table? I have some stored procedures that are identical with the difference of one statement in the WHERE clause. If I create a single View and specify also in this View the WHERE clause that is common in these stored procedures, I will have the new stored procecures changed to be like:
19
3573
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and clicks the cmdShowResults button on the main form, the subform returns the records based on the two criteria. The criteria used on the main form are values selected in two list boxes. When the user clicks on the first list box (lstCollege), it returns values in the second list box...
8
4722
by: | last post by:
Hello, This is gonna sound real daft, but how do I test a Select Case statement for variants of a theme? Here's a snippet of my code... Select Case sUsr Case "Guest", "TsInternetUser", "krbtgt", "quality7" ' don't show
4
2276
by: Ian Richardson | last post by:
Hi, The function I've put together below is a rough idea to extend a SELECT list, starting from: <body> <form name="bambam"> <select id="fred"> <option value="1">1</option> <option value="2">2</option>
5
2565
by: Henning M | last post by:
Hi all, I having some problems with Access and selecting records between dates.. When I try this in access, it works fine!! "Select * from Bilag Where Mdates Between #1/1/2006# And #31/1/2006#" But when I try it from my vb.net app, I get ALL the records in the tabel?? What goes wrong? I haven't been able to find any info on the net, besides others having
0
9643
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, 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...
0
9480
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,...
0
10147
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 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...
0
9946
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...
1
7494
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
6735
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
5378
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
4044
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
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.