473,748 Members | 8,773 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple queries?

24 New Member
I think this would be the proper title for the problem im currently having.

Just a jyst of what the problem im running into is....

1) This page was coded by yet again the same employee whom used to work here a few years back, with time, we need to update.

2) The problem is, we used to only ship via UPS, but now that we offer shipping through other means. However, the page I am working on only allows for orders with UPS tracking numbers to show.

Example

Order Number Status Tracking Number
9999999 Shipped 1ZXXXXXXXXXX
9999998 Shipped


From the top we see that it will show the UPS but not the USPS order. I changed the code up and was able to switch it around vice versa and was dumbfounded as to why it wouldnt show both.

Now that ive confirmed that both items are in two different tables of the db I can figure out how to code it so that I can access both tables, while retaining information from both. (Am I even making any sense?)

Heres a portion of the code.

Expand|Select|Wrap|Line Numbers
  1.         i = 0
  2.  
  3.         if not rstemp.eof then
  4.  
  5.             set rs = createobject("adodb.recordset")
  6.  
  7.             do until rstemp.eof OR howmanyrecs>=maxrecs
  8.  
  9.                 invoice_id = rstemp("unique_key")
  10.                 invoice_status = rstemp("invoice_status")
  11.  
  12.  
  13.                 invoice_tracking = ""
  14.  
  15.  
  16.                 set rs = createobject("adodb.recordset")
  17.                 rs.open "select * from invoices where invoice_tracking = '" & rstemp("invoice_tracking") & "'",strDSN,3,1
  18.  
  19.  
  20.                 if not rs.eof then        
  21.                     if isnull(rs("invoice_tracking")) or rs("invoice_tracking") = null then
  22.                         invoice_tracking = "NO TRACKING # YET"
  23.                     else
  24.                         invoice_tracking = rs("invoice_tracking")
  25.                     end if
  26.                 end if
  27.  
  28.  
  29.                 x_1 = x_1 + 1
  30.  
  31.                 row_name = "abc" & trim(rstemp("invoice_tracking")) & "_" & x_1
  32.                 row_name = replace(row_name," ","")
  33.                 row_name = replace(row_name,".","")
  34.                 row_name = replace(row_name,"'","")
  35.                 row_name = replace(row_name,"@","")
  36.                 row_name = replace(row_name,"?","")
  37.                 row_name = replace(row_name,"%","")
  38.                 row_name = replace(row_name,"!","")
  39.                 row_name = replace(row_name,"#","")
  40.                 row_name = replace(row_name,"$","")
  41.                 row_name = replace(row_name,"^","")
  42.                 row_name = replace(row_name,"*","")
  43.                 row_name = replace(row_name,"(","")
  44.                 row_name = replace(row_name,")","")
  45.                 row_name = row_name & "_" & i                
  46.  
  47.                  i = i + 1
  48.                 if i mod 2 = 0 then
  49.                     response.write "<tr bgcolor='#cccccc'>" 
  50.                 else
  51.                     response.write "<tr bgcolor='#ffffff'>"
  52.                 end if
  53.  
  54.                 if instr(invoice_tracking,"1Z5354RV") then
  55.                     invoice_tracking = "<a href=pages_x_orders_tracking.asp?rid=" & invoice_tracking & ">" & invoice_tracking & "</a>"
  56.                 end if
  57.  
  58.                 if instr(invoice_tracking,"1Z2Y3656") then
  59.                     invoice_tracking = "<a href=pages_x_orders_tracking.asp?rid=" & invoice_tracking & ">" & invoice_tracking & "</a>"
  60.                 end if
  61.  
  62.                 if instr(invoice_tracking,"9101") then
  63.                 invoice_tracking = "<a href=pages_x_orders_tracking.asp?rid=" & invoice_tracking & ">" & invoice_tracking & "</a>"
  64.                 end if
  65.  
  66.                 response.write "<font size='2'>"
  67.                 response.write "<td valign='top'><font face='Arial' size='2'>" & invoice_id & "</font></td>"
  68.                 response.write "<td valign='top'><font face='Arial' size='2'>" & invoice_status & "</font></td>"
  69.                 response.write "<td valign='top'><font face='Arial' size='2'>" & invoice_tracking & "</font></td>"
  70.                 response.write "</font></tr>"
  71.  
  72.  
Thanks in advance everyone,

Gregory Gawaran
Apr 30 '07 #1
8 1502
iam_clint
1,208 Recognized Expert Top Contributor
I wouldn't have used two different tables


but you can join the tables togethor in a query

select * from tracking t
left outer join other_tracking o on t.column = o.column
where yadda = 1
order by date

to join them togethor where i put t.column = o.column there has to be something to match one table to the other like user_Id or something so it would be like on t.user_id = o.user_id
Apr 30 '07 #2
GGawaran
24 New Member
so instead of this

Expand|Select|Wrap|Line Numbers
  1.                 set rs = createobject("adodb.recordset")
  2.                 rs.open "select * from invoices where invoice_tracking = '" & rstemp("invoice_tracking") & "'",strDSN,3,1
  3.  
use this?

Expand|Select|Wrap|Line Numbers
  1. select * from tracking t(t being the element in the table tracking?)
  2. left outer join other_tracking(which would be the other table?) o on t.column = o.column
  3. where yadda = 1 (im abit confused by this piece of code)
  4. order by date
  5.  
Thanks,

Gregory Gawaran
Apr 30 '07 #3
GGawaran
24 New Member
this is how i interpretted what you said to do, but, am not sure if its right, well everything but the yadda part haha.

Expand|Select|Wrap|Line Numbers
  1.                 set rs = createobject("adodb.recordset")
  2.                 rs.open "select * from tracking tracking_number
  3.                 left outer join invoices invoice_tracking on tracking_number.column = invoice_tracking.column
  4.                 where yadda = 1
  5.                 order by date" 
  6.                 & rstemp("invoice_tracking") & "'",strDSN,3,1
  7.  
thanks,

Gregory Gawaran
Apr 30 '07 #4
iam_clint
1,208 Recognized Expert Top Contributor
column actually needs to be a column name, one where it = the other
May 1 '07 #5
GGawaran
24 New Member
ah alrighty, as for yadda, what goes there?
May 1 '07 #6
GGawaran
24 New Member
I was having a problem with unterminated string, but i have fixed that problem (i think?) and now the error im getting is ""Microsoft OLE DB Provider for ODBC Drivers error '80040e21' ODBC driver does not support the requested properties."" its saying the error is on 184, which is where this string of code sits.

This is the code I have for the combine, but I don't know if its correct and is causing the problem but here is the code.
Expand|Select|Wrap|Line Numbers
  1.                 set rs = createobject("adodb.recordset")
  2.                 rs.open "select * from tracking tracking_number    left outer join invoices invoice_tracking on tracking.tracking_number = invoices.invoice_tracking where yadda = 1 order by date" & rstemp("invoice_tracking") & "'",strDSN,3,1
  3.  
  4.  
Im assuming that for the column =, the first part is the table, and the second after the . is the column within the table?

Thanks again in advance,

Gregory Gawaran
May 1 '07 #7
iam_clint
1,208 Recognized Expert Top Contributor
yes
Expand|Select|Wrap|Line Numbers
  1. rs.open "select * from tracking tracking_number    left outer join invoices invoice_tracking on tracking.tracking_number = invoices.invoice_tracking order by date",strDSN,3,1
  2.  
May 1 '07 #8
GGawaran
24 New Member
yes
Expand|Select|Wrap|Line Numbers
  1. rs.open "select * from tracking tracking_number    left outer join invoices invoice_tracking on tracking.tracking_number = invoices.invoice_tracking order by date",strDSN,3,1
  2.  
thanks alot clint, learned something new yet again thanks to you guys.

Gregory Gawaran

PS

Keep up the great help you guys offer us newbies.
May 2 '07 #9

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

Similar topics

4
16758
by: DG | last post by:
Hi, Can anyone advise how to execute multiple statements in a single query batch. For example- update customers set customer_name = 'Smith' where customer_name = 'Smyth'; select * from customers; I can execute each statement individually but get the 'you have an error in
1
3452
by: Jeremy | last post by:
I have built a form that calls queries. I have the first 2 set up as select queries, and the third set up as a make table query. When multiple users are on this application at the same time, they get errors or the data is overwritten while they are sitting there. If I do all select queries, 1. the records pop up if I use a "RUN" command button, or if I have my "Report" command button set to the last query then each time they hit one of...
0
8777
by: MHenry | last post by:
Hi, I know virtually nothing about creating Macros in Access. I would appreciate some help in creating a Macro or Macros that automatically run(s) 14 Queries (three Make Table Queries, and 11 Append Queries) when the Database is first opened, and then again anytime I invoke the Macro (somehow) after the database is already open. The latter function is useful, because the queries must be rerun every time data is added, deleted, or...
11
4532
by: dskillingstad | last post by:
I've been struggling with this problem for some time and have tried multiple solutions with no luck. Let me start with, I'm a novice at Access and I'm not looking for someones help to design my database,just help in getting me pointed in the right direction. I have a database with 8 tables, which from what I have read, cannot be linked on a single form, and be updatable. I have created a query which includes all 8 tables, and then...
4
3754
by: Dave Edwards | last post by:
I understand that I can fill a datagrid with multiple queries, but I cannot figure out how to fill a dataset with the same query but run against multiple SQL servers, the query , table structure and username, password etc will be exactly the same for each server, the only thing that will change is the server name. Idealy I would like to get the server names from a seperate dataset so there could be any number of servers, allthough in...
1
1620
by: mattcatmattcat | last post by:
I have a VB7 aspx file I am creating that requires multiple queries each dependant on the previous queries results. If I run these queries in foxpro, I just run a query then create a cursor with the results of that cursor, then run another query based on that cursor etc. My question is, how do I do this in a VB7 aspx file? Below I have the code for the first query but I am not sure where to go from here to run the rest of the queries that...
8
3185
by: beretta819 | last post by:
Ok, so I apologize in advance for the wordiness of what follows... (I am not looking for someone to make this for me, but to point me in the right direction for the steps I need to take.) I was nominated at work to design a "system" that would allow us to track the performance of our employees. So I thought Access. Should be simple enough because I have made simple DB's with it before. I was wrong. This has turned into a bigger deal than I...
7
4729
by: vaiism | last post by:
I am creating a report that outputs the contact information and details about a water treatment plant, and needs to include information about people who work there. If I tie all the information to a single query the report contains a full set of information for the plant for each of the people who work there. If I embed multiple queries into the report, the user has to input the search criteria once for each of the queries that is being...
11
3674
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night) and the 'employee name'. There is another table which assigns an ID to the Shifts, i.e. 1,2 and 3 for morn, eve & night shifts respectively. From the mother table, the incentive is calculated datewise for each employee as per his shift duty. In...
14
6684
by: Supermansteel | last post by:
My team at work uses Cognos to run multiple queries to pull in data. Then they take that data and import into Access and then usually run an Append Query to run a RND function to pull out a few samples for them to review the accounts. I was making a suggestion to my team that maybe if we only ran one Cognos query and pulled in all of the columns that everyone needs to pull samples for each of there tests that this would be better on the time...
0
8831
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
9548
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...
0
9374
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...
1
9325
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
8244
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...
0
4607
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...
0
4876
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
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.