Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old October 6th, 2004, 02:34 AM
kiran_karnati kiran_karnati is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Location: Braunschweig , Germany
Posts: 39 kiran_karnati User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 44 m 5 sec
Reputation Power: 4
Send a message via Yahoo to kiran_karnati
Unhappy How to write this query in MS ACCESS 2002 VBA

hei all
I have a query in access which I have to excecute and get the result of this query in a recordset.
I have copied the SQL statement of the sql view of this query and made some changes but it is not working.
Saying that "Syntax is failed "
can any one , who is good in writing SQL queries in access please help me.
I am attaching the query how it looks in design view of Access.


This is the way how it looks in SQL view of access.
__________________________________________________ _________

SELECT Make.id, Make.description, Motor.id, Motor.Art, Motor.Litre, Motor.KW, Motor.description, Vehicletype.Vehicle_Type_id, Vehicletype.description, Vehicletype.year, Getriebe.id, Getriebe.Art, Getriebe.Nummer, Getriebe.description, Antriebe.id, Antriebe.Art, Antriebe.nummer, Antriebe.description, Vehicletype.objid, Vehicletype.Türen, Vehicletype.XL_DCHA_Path, Vehicletype.XL_DCHATA_path, Vehicletype.XL_DCHATATP_Path, Vehicletype.XL_XTHA_Path, Vehicletype.XL_XTTA_Path, Vehicletype.XL_Empty_Path, Vehicletype.XL_Pic_Path, Vehicletype.XL_Graphic_Path
FROM Motor RIGHT JOIN (Make RIGHT JOIN (Getriebe RIGHT JOIN (Antriebe RIGHT JOIN Vehicletype ON Antriebe.objid = Vehicletype.Antriebe_objid) ON Getriebe.objid = Vehicletype.Getriebe_objid) ON Make.objid = Vehicletype.Make_objid) ON Motor.objid = Vehicletype.Motor_objid;

__________________________________________________ ____________

Please help me!..
thanks in advance,
Kiran.
Attached Images
File Type: jpg query.JPG (35.8 KB, 179 views)

Reply With Quote
  #2  
Old October 12th, 2004, 02:30 PM
JamesLe JamesLe is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Oakland, CA, USA
Posts: 131 JamesLe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 6 m
Reputation Power: 4
Smile RE: How to write this query in MS ACCESS 2002 VBA

Hello Kiran,

Probably, the select statement is too long to fit in one line. You may need to break it down into several lines by using "_" at the end of each line. Hope it will help.


Since this message section is not allow me to put more than 95 characters per line. That's why I chopped it off so many lines. You can just break this statement into 3 or 4 lines, that is good enough.

'-----------------
Dim MyDB As Database
Dim MySet As Recordset
Dim strSQL As String

strSQL = "SELECT Make.id, Make.description, Motor.id, Motor.Art, Motor.Litre, Motor.KW," & _
" Motor.description, Vehicletype.Vehicle_Type_id, Vehicletype.description," & _
" Vehicletype.year, Getriebe.id, Getriebe.Art, Getriebe.Nummer, Getriebe.description," & _
" Antriebe.id, Antriebe.Art, Antriebe.nummer, Antriebe.description, Vehicletype.objid," & _
" Vehicletype.Türen, Vehicletype.XL_DCHA_Path, Vehicletype.XL_DCHATA_path," & _
" Vehicletype.XL_DCHATATP_Path, Vehicletype.XL_XTHA_Path, Vehicletype.XL_XTTA_Path," & _
" Vehicletype.XL_Empty_Path, Vehicletype.XL_Pic_Path, Vehicletype.XL_Graphic_Path" & _
" FROM Motor RIGHT JOIN (Make RIGHT JOIN (Getriebe RIGHT JOIN" & _
" (Antriebe RIGHT JOIN Vehicletype ON Antriebe.objid = Vehicletype.Antriebe_objid)" & _
" ON Getriebe.objid = Vehicletype.Getriebe_objid) ON Make.objid = Vehicletype.Make_objid)" & _
" ON Motor.objid = Vehicletype.Motor_objid;"

Set MyDB = CurrentDB
Set MySet = MyDB.OpenRecordSet(strSQL)

Do Until MySet.EOF

'Insert your manipulated statement here!

MySet.MoveNext
Loop

'------------------------

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > How to write this query in MS ACCESS 2002 VBA


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway