Not necessarily!

Regards,
Sam

On Sun, Jun 24, 2012 at 8:40 AM, David Grugeon <da...@grugeon.com.au> wrote:

> I thought SQL required all statements to end in a semicolon ??
>
>
> On Sunday, 24 June 2012, TJ wrote:
>
>> Thanks much
>>
>> I went ahead a copied that into the Editor and it looks like it added a
>> few quotes and arranged some things automatically.  Assume some sort of
>> autocorrect mechanism.  Ran it and it threw a  "Run Time error '424':
>> Object Required"  on the "VV_VESSEL_VISIT.VESSEL_ID ,
>> VV_VESSEL_VISIT.ARR_VOYAGE, " "  line.
>>
>> Thanks again.
>>
>> Sub Get_Vessel_Schedule()
>> Dim cn              As ADODB.Connection
>> Dim rs              As ADODB.Recordset
>> Dim strSql          As String
>>
>> Set cn = New ADODB.Connection
>> Set rs = New ADODB.Recordset
>> cn.Open ( _
>>     "User ID=" & _
>>     ";Password=" & _
>>     ";Data Source=mit.world" & _
>>     ";Provider=MSDAORA.1")
>>
>> strSql = ""
>> strSql = strSql & vbLf & "select VESSEL.CODE, VESSEL.NAME, "
>> VV_VESSEL_VISIT.VESSEL_ID , VV_VESSEL_VISIT.ARR_VOYAGE, " "
>> strSql = strSql & vbLf & "VV_VESSEL_VISIT.DEP_VOYAGE, "
>> VV_VESSEL_VISIT.BERTH , VV_VESSEL_VISIT.MPH, " "
>> strSql = strSql & vbLf & "VV_VESSEL_VISIT.ESC_FORWARD_DRAFT, "
>> VV_VESSEL_VISIT.ATA , VV_VESSEL_VISIT.ATD, " "
>> strSql = strSql & vbLf & "VV_VESSEL_VISIT.ETA, VV_VESSEL_VISIT.ETD from
>> VV_VESSEL_VISIT"
>> strSql = strSql & vbLf & "join"
>> strSql = strSql & vbLf & "VESSEL on VV_VESSEL_VISIT.VESSEL_ID=VESSEL.ID"
>> rs.Open strSql, cn
>> Cells(6, 6).CopyFromRecordset rs
>> End Sub
>>
>> On Friday, June 22, 2012 7:14:55 PM UTC-5, TJ wrote:
>>
>>> Hello,
>>>
>>> Super new to thsi world but trying to put something together that will
>>> execute a simple SQL statement against on of our Oracle Databases and
>>> return the results.  The Code for the Macro is below but I am getting "Data
>>> Type is not Supported".  Anyone help with that.  Also, another question
>>> which may be simple sytax I do nto know, what is a good mechanism to break
>>> out the SQL statments accross various lines instead of one line?
>>>
>>> BTW, using Excel 2010.
>>>
>>> Thanks In Advance.
>>>
>>>
>>> Sub Get_Vessel_Schedule()
>>>
>>> Dim cn As ADODB.Connection
>>> Dim rs As ADODB.Recordset
>>>
>>> Set cn = New ADODB.Connection
>>> Set rs = New ADODB.Recordset
>>>
>>> cn.Open ( _
>>>     "User ID=User" & _
>>>     ";Password=Pass" & _
>>>     ";Data Source=My DB" & _
>>>     ";Provider=MSDAORA.1")
>>>
>>> rs.Open "select VESSEL.CODE, VESSEL.NAME, VV_VESSEL_VISIT.VESSEL_ID,
>>> VV_VESSEL_VISIT.ARR_VOYAGE, VV_VESSEL_VISIT.DEP_VOYAGE,
>>> VV_VESSEL_VISIT.BERTH, VV_VESSEL_VISIT.MPH, VV_VESSEL_VISIT.ESC_FORWARD_
>>> **DRAFT, VV_VESSEL_VISIT.ATA, VV_VESSEL_VISIT.ATD, VV_VESSEL_VISIT.ETA,
>>> VV_VESSEL_VISIT.ETD from VV_VESSEL_VISIT join VESSEL on
>>> VV_VESSEL_VISIT.VESSEL_ID=VESS**EL.ID <http://VESSEL.ID>", cn
>>>
>>>
>>> Cells(6, 6).CopyFromRecordset rs
>>>
>>> End Sub
>>>
>>>
>>>
>>  --
>> -- FORUM RULES (986+ members already BANNED for violation) 1) Use
>> concise, accurate thread titles. Poor thread titles, like Please Help,
>> Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not
>> get quick attention or may not be answered. 2) Don't post a question in the
>> thread of another member. 3) Don't post questions regarding breaking or
>> bypassing any security measure. 4) Acknowledge the responses you receive,
>> good or bad. 5) Cross-promotion of, or links to, forums competitive to this
>> forum in signatures are prohibited. NOTE : Don't ever post personal or
>> confidential data in a workbook. Forum owners and members are not
>> responsible for any loss.
>> ------------------------------------------------------------------------------------------------------
>> To post to this group, send email to excel-macros@googlegroups.com To
>> unsubscribe, send a blank email to
>> excel-macros+unsubscr...@googlegroups.com
>
>
>
> --
> David Grugeon
>
>  --
> -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise,
> accurate thread titles. Poor thread titles, like Please Help, Urgent, Need
> Help, Formula Problem, Code Problem, and Need Advice will not get quick
> attention or may not be answered. 2) Don't post a question in the thread of
> another member. 3) Don't post questions regarding breaking or bypassing any
> security measure. 4) Acknowledge the responses you receive, good or bad. 5)
> Cross-promotion of, or links to, forums competitive to this forum in
> signatures are prohibited. NOTE : Don't ever post personal or confidential
> data in a workbook. Forum owners and members are not responsible for any
> loss.
> ------------------------------------------------------------------------------------------------------
> To post to this group, send email to excel-macros@googlegroups.com To
> unsubscribe, send a blank email to
> excel-macros+unsubscr...@googlegroups.com
>



-- 
Sam Mathai Chacko

-- 
-- 
FORUM RULES (986+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

To unsubscribe, send a blank email to excel-macros+unsubscr...@googlegroups.com


Reply via email to