473,404 Members | 2,187 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,404 software developers and data experts.

Help with code

Currently I have a query that brings all the information i need except
for one piece found in another table. My current query looks like:

strConnect = "Driver={Microsoft Access Driver (*.mdb)};
DBQ=\\CALSJ1\PMAPPS\pmdata.mdb"

Set objRecordset = Server.CreateObject ("ADODB.Recordset")

objRecordset.Open "mstJobs", strConnect, adOpenStatic,
adLockOptimistic, adCmdTable
I need to pull the JobName from another table in which both tables have
the JobNumber in common.

I am not sure how what the SQL syntax for doing this would be...

Any help is appreciated.

Thanks

Apr 10 '06 #1
6 1177

mw******@caldrywall.com wrote:
Currently I have a query that brings all the information i need except
for one piece found in another table. My current query looks like:

strConnect = "Driver={Microsoft Access Driver (*.mdb)};
DBQ=\\CALSJ1\PMAPPS\pmdata.mdb"

Set objRecordset = Server.CreateObject ("ADODB.Recordset")

objRecordset.Open "mstJobs", strConnect, adOpenStatic,
adLockOptimistic, adCmdTable
I need to pull the JobName from another table in which both tables have
the JobNumber in common.

I am not sure how what the SQL syntax for doing this would be...

Any help is appreciated.

Thanks

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ=c:\anydatabase.mdb"

set RS = Conn.Execute("Select table1.field1 as f1, table2.field2 as f2
FROM table1, table2 WHERE table1.field1=table2.field2")

If not RS.eof then
RS.movefirst
Do
Response.write "table1 field1 = " & RS("f1") & "table2 field2 = " &
RS("f2")
Rs.movenext
Loop until RS.eof
End if
hope it helps

zafar
--------------------------------
http://www.vbuniverse.com/

Apr 11 '06 #2

mw******@caldrywall.com wrote:
Currently I have a query that brings all the information i need except
for one piece found in another table. My current query looks like:

strConnect = "Driver={Microsoft Access Driver (*.mdb)};
DBQ=\\CALSJ1\PMAPPS\pmdata.mdb"

Set objRecordset = Server.CreateObject ("ADODB.Recordset")

objRecordset.Open "mstJobs", strConnect, adOpenStatic,
adLockOptimistic, adCmdTable
I need to pull the JobName from another table in which both tables have
the JobNumber in common.

I am not sure how what the SQL syntax for doing this would be...

Any help is appreciated.

Thanks


You need to use a JOIN. The easiest way to learn this syntax is to do
create some queries linking the two tables in Access, then looking at
the resulting SQL. You haven't given any field or table names in your
post, so here's an example:

tblJobDetails
ID
JobNumber
JobDate
JobManager

tblJob
JobNumber
JobName

SELECT tblJobDetails.ID, tblJobDetails.JobDate,
tblJobDetails.JobManager, tblJob.JobName FROM tblJobDetails INNER JOIN
tblJob ON tblJobDetails.JobNumber = tblJob.JobNumber.

By the way, you are using the old ODBC driver. You should switch to
the native OLEDB driver. See here:
http://www.aspfaq.com/show.asp?id=2126

--
Mike Brind

Apr 11 '06 #3

mw******@caldrywall.com wrote:
Currently I have a query that brings all the information i need except
for one piece found in another table. My current query looks like:

strConnect = "Driver={Microsoft Access Driver (*.mdb)};
DBQ=\\CALSJ1\PMAPPS\pmdata.mdb"

Set objRecordset = Server.CreateObject ("ADODB.Recordset")

objRecordset.Open "mstJobs", strConnect, adOpenStatic,
adLockOptimistic, adCmdTable
I need to pull the JobName from another table in which both tables have
the JobNumber in common.

I am not sure how what the SQL syntax for doing this would be...

Any help is appreciated.

Thanks


You need to use a JOIN. The easiest way to learn this syntax is to do
create some queries linking the two tables in Access, then looking at
the resulting SQL. You haven't given any field or table names in your
post, so here's an example:

tblJobDetails
ID
JobNumber
JobDate
JobManager

tblJob
JobNumber
JobName

SELECT tblJobDetails.ID, tblJobDetails.JobDate,
tblJobDetails.JobManager, tblJob.JobName FROM tblJobDetails INNER JOIN
tblJob ON tblJobDetails.JobNumber = tblJob.JobNumber.

By the way, you are using the old ODBC driver. You should switch to
the native OLEDB driver. See here:
http://www.aspfaq.com/show.asp?id=2126

--
Mike Brind

Apr 11 '06 #4

mw******@caldrywall.com wrote:
Currently I have a query that brings all the information i need except
for one piece found in another table. My current query looks like:

strConnect = "Driver={Microsoft Access Driver (*.mdb)};
DBQ=\\CALSJ1\PMAPPS\pmdata.mdb"

Set objRecordset = Server.CreateObject ("ADODB.Recordset")

objRecordset.Open "mstJobs", strConnect, adOpenStatic,
adLockOptimistic, adCmdTable
I need to pull the JobName from another table in which both tables have
the JobNumber in common.

I am not sure how what the SQL syntax for doing this would be...

Any help is appreciated.

Thanks


You need to use a JOIN. The easiest way to learn this syntax is to do
create some queries linking the two tables in Access, then looking at
the resulting SQL. You haven't given any field or table names in your
post, so here's an example:

tblJobDetails
ID
JobNumber
JobDate
JobManager

tblJob
JobNumber
JobName

SELECT tblJobDetails.ID, tblJobDetails.JobDate,
tblJobDetails.JobManager, tblJob.JobName FROM tblJobDetails INNER JOIN
tblJob ON tblJobDetails.JobNumber = tblJob.JobNumber.

By the way, you are using the old ODBC driver. You should switch to
the native OLEDB driver. See here:
http://www.aspfaq.com/show.asp?id=2126

--
Mike Brind

Apr 11 '06 #5

Mike Brind wrote:
mw******@caldrywall.com wrote:
Currently I have a query that brings all the information i need except
for one piece found in another table. My current query looks like:

strConnect = "Driver={Microsoft Access Driver (*.mdb)};
DBQ=\\CALSJ1\PMAPPS\pmdata.mdb"

Set objRecordset = Server.CreateObject ("ADODB.Recordset")

objRecordset.Open "mstJobs", strConnect, adOpenStatic,
adLockOptimistic, adCmdTable
I need to pull the JobName from another table in which both tables have
the JobNumber in common.

I am not sure how what the SQL syntax for doing this would be...

Any help is appreciated.

Thanks


You need to use a JOIN. The easiest way to learn this syntax is to do
create some queries linking the two tables in Access, then looking at
the resulting SQL. You haven't given any field or table names in your
post, so here's an example:

tblJobDetails
ID
JobNumber
JobDate
JobManager

tblJob
JobNumber
JobName

SELECT tblJobDetails.ID, tblJobDetails.JobDate,
tblJobDetails.JobManager, tblJob.JobName FROM tblJobDetails INNER JOIN
tblJob ON tblJobDetails.JobNumber = tblJob.JobNumber.

By the way, you are using the old ODBC driver. You should switch to
the native OLEDB driver. See here:
http://www.aspfaq.com/show.asp?id=2126

--
Mike Brind


Just like busses - you wait for ages for one to come along, then 3 come
along all at the same time....

*%^*^%$"^!! Google!

--
Mike Brind

Apr 11 '06 #6
Nice!!! Thanks for the advice

Apr 11 '06 #7

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

Similar topics

4
by: PHPkemon | last post by:
Hi there, A few weeks ago I made a post and got an answer which seemed very logical. Here's part of the post: PHPkemon wrote: > I think I've figured out how to do the main things like...
6
by: d.warnermurray | last post by:
I am doing a project for school that involves creating help files for a html authoring tool. If you could help me with answers to some questions it would really help. 1. What tasks do you expect...
6
by: Mark Reed | last post by:
Hi all, I am trying to learn a little about programming (I know next to nothing so far) and have found some code which hides the toolbars. However, this bit of code is a little too effective and...
4
by: dixie | last post by:
Help, I'm really out of my depth here (not unusual I hear you say :-). I have just installed HTML Help in an application. I told it in the Project Properties the path to the help file. I then...
7
by: Timothy Shih | last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I wrote a simple function which takes in 2 buffers (one a byte buffer, one a char buffer) and copies the contents of the byte...
23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
16
by: Allen | last post by:
I have a class that returns an arraylist. How do I fill a list box from what is returned? It returns customers which is a arraylist but I cant seem to get the stuff to fill a list box. I just...
3
by: inkexit | last post by:
I need help figuring out what is wrong with my code. I posted here a few weeks ago with some code about creating self similar melodies in music. The coding style I'm being taught is apparently a...
1
by: glenn123 | last post by:
Hi, i am just about out of time to produce a working jukebox which has to perform these functions: to play music files when a track is chosen from a list which when the user presses the change genre...
10
by: JonathanOrlev | last post by:
Hello everybody, I wrote this comment in another message of mine, but decided to post it again as a standalone message. I think that Microsoft's Office 2003 help system is horrible, probably...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
0
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...
0
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,...
0
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...

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.