VBA Code vs. VBScript Code

VBA Code vs. VBScript Code

Post by Hao Den » Sat, 14 Sep 2002 21:44:21



Hi,

I am experiencing some weird situation. The following code
can be run successfully in Excel. But when I shift them to
VBScript, I got an error message telling me "Unexpected
Error - Provider: Retrieving Data" on line of retrieving
recordset. And yes, I changed the syntax to clear the
difference beween VB and VBScript.

I checked status step by step and found the database is
opened conn.state = adStateOpen and dbcmd.state = 0. So I
am guessing there should be something wrong with the
recordset.

Since I am new to this area, could someone please help
with this?

The purpose of the following code is to get historical
data from SQL DB through a third party provider. The
format of the command is listed under .CommandText.

Thanks a lot in advance,

Hao Deng

Dim conn As ADODB.Connection
Dim dbcmd As ADODB.Command
Dim rs1 As ADODB.Recordset
Dim icols As Integer
Dim ws As Worksheet

Sub sub_test()

tagatom = "110AALI100SEL.PV/SIG"
' tagatom = "SINE1.PV/SIG"
adate = "9/10/2002 9:15:00 AM"
dtime = "9/10/2002 10:00:00 AM"
suffixcode = "1"  ' 0=raw,
1=avg,2=max,3=min,4=sum,5=int,6=range,7=first,8=last
Interval = "1"
IntervalUnit = "2"   '
1=sec,2=min,3=hour,4=day,5=week,6=month,7=year,8=shift,9=ha
lfday,10=twomonth,11=quarter,12=halfyear

'Create variables for ADO Connection and Resultset
Set dbcmd = CreateObject("ADODB.Command")
Set conn = CreateObject("ADODB.Connection")
conn.CursorLocation = adUseClient
conn.Mode = adModeRead
conn.Open ("Provider = MNT_Historian")

Set dbcmd.ActiveConnection = conn
dbcmd.CommandType = adCmdText
' dbcmd.CommandType = adRowset
dbcmd.CommandText = tagatom & "," & adate & "," & dtime
& "," & suffixcode & "," & Interval & "," & IntervalUnit
' dbcmd.Execute
dbcmd.CommandTimeout = 180

Set rs1 = CreateObject("ADODB.recordset")
rs1.CacheSize = 100
rs1.CursorType = adOpenStatic
rs1.LockType = adLockReadOnly

rs1.Open dbcmd

' arrResults = rs1.GetRows

Set ws = Excel.ActiveSheet
ws.Cells.ClearContents
ws.Cells.ClearFormats

If (rs1.EOF = True) Then
    Debug.Print "No Return Values!"
Else
    For icols = 0 To rs1.Fields.Count - 1
        ws.Cells(7, icols + 1).Value = rs1.Fields
(icols).Name
        Next

        ws.Range("A3") = "TagAtom:"
        ws.Range("B3") = tagatom

        ws.Range("A8").CopyFromRecordset rs1

        ws.Columns("A").NumberFormat = "mm/dd/yyyy h:mm:ss
AM/PM"
        ws.Columns.AutoFit

End If

    rs1.Close
    Set rs1 = Nothing

End Sub

 
 
 

VBA Code vs. VBScript Code

Post by Roy Fin » Sat, 14 Sep 2002 22:06:19


Hao Deng

have you defined the ADO constants that you are using.  For instance,
adOpenStatic, adCmdText mean absolutely nothing in VBScript unless you
explicitly set them -- unless you are in an ASP environment and have
explicitly referenced a type library or included the adovbs.inc file.

If you are using VBScript in a standalone environment, you may need to
include (as in copy and paste) the constant definitions from:
C:\Program Files\Common Files\System\ado\adovbs.inc

regards
roy fine


Quote:> Hi,

> I am experiencing some weird situation. The following code
> can be run successfully in Excel. But when I shift them to
> VBScript, I got an error message telling me "Unexpected
> Error - Provider: Retrieving Data" on line of retrieving
> recordset. And yes, I changed the syntax to clear the
> difference beween VB and VBScript.

> I checked status step by step and found the database is
> opened conn.state = adStateOpen and dbcmd.state = 0. So I
> am guessing there should be something wrong with the
> recordset.

> Since I am new to this area, could someone please help
> with this?

> The purpose of the following code is to get historical
> data from SQL DB through a third party provider. The
> format of the command is listed under .CommandText.

> Thanks a lot in advance,

> Hao Deng

> Dim conn As ADODB.Connection
> Dim dbcmd As ADODB.Command
> Dim rs1 As ADODB.Recordset
> Dim icols As Integer
> Dim ws As Worksheet

> Sub sub_test()

> tagatom = "110AALI100SEL.PV/SIG"
> ' tagatom = "SINE1.PV/SIG"
> adate = "9/10/2002 9:15:00 AM"
> dtime = "9/10/2002 10:00:00 AM"
> suffixcode = "1"  ' 0=raw,
> 1=avg,2=max,3=min,4=sum,5=int,6=range,7=first,8=last
> Interval = "1"
> IntervalUnit = "2"   '
> 1=sec,2=min,3=hour,4=day,5=week,6=month,7=year,8=shift,9=ha
> lfday,10=twomonth,11=quarter,12=halfyear

> 'Create variables for ADO Connection and Resultset
> Set dbcmd = CreateObject("ADODB.Command")
> Set conn = CreateObject("ADODB.Connection")
> conn.CursorLocation = adUseClient
> conn.Mode = adModeRead
> conn.Open ("Provider = MNT_Historian")

> Set dbcmd.ActiveConnection = conn
> dbcmd.CommandType = adCmdText
> ' dbcmd.CommandType = adRowset
> dbcmd.CommandText = tagatom & "," & adate & "," & dtime
> & "," & suffixcode & "," & Interval & "," & IntervalUnit
> ' dbcmd.Execute
> dbcmd.CommandTimeout = 180

> Set rs1 = CreateObject("ADODB.recordset")
> rs1.CacheSize = 100
> rs1.CursorType = adOpenStatic
> rs1.LockType = adLockReadOnly

> rs1.Open dbcmd

> ' arrResults = rs1.GetRows

> Set ws = Excel.ActiveSheet
> ws.Cells.ClearContents
> ws.Cells.ClearFormats

> If (rs1.EOF = True) Then
>     Debug.Print "No Return Values!"
> Else
>     For icols = 0 To rs1.Fields.Count - 1
>         ws.Cells(7, icols + 1).Value = rs1.Fields
> (icols).Name
>         Next

>         ws.Range("A3") = "TagAtom:"
>         ws.Range("B3") = tagatom

>         ws.Range("A8").CopyFromRecordset rs1

>         ws.Columns("A").NumberFormat = "mm/dd/yyyy h:mm:ss
> AM/PM"
>         ws.Columns.AutoFit

> End If

>     rs1.Close
>     Set rs1 = Nothing

> End Sub


 
 
 

VBA Code vs. VBScript Code

Post by Hao Den » Sat, 14 Sep 2002 22:51:53


Hi Roy,

Thank you so much for your advice.

Yes. I did include the ADOVBS.inc file in the header. I
also have tried to change the enumerators to their
respective numeric values. The following are the codes in
its VBS version.

We are wondering if there is anything wrong with the
datatype e.g. the datetime in SQL can be recognized by VBA
but not by VBS.

<html>
<body>
<!-- #include file = "adovbs.inc" -->
<%

'on Error Resume Next
tagatom = "110AALI100SEL.PV/SIG"
adate = "5 Sep 2002 10:00:00"
dtime = "5 Sep 2002 10:01:00"
suffixcode = "1"
Interval = "1"
IntervalUnit = "3"

'Create variables for ADO Connection and Resultset
Set dbcmd = CreateObject("ADODB.Command")
Set conn = CreateObject("ADODB.Connection")
set objError = CreateObject("ADODB.error")

conn.CursorLocation = adUseClient
conn.Mode = adModeRead
conn.Provider = "MNT_Historian"
conn.open

dbcmd.ActiveConnection = conn
dbcmd.CommandType = adCmdText
dbcmd.CommandText = "110AALI100SEL.PV/SIG,5 SEP 2002
10:00:00,5 SEP 2002 11:00:00,1,1,3"
dbcmd.CommandTimeout = 180

Set RS1 = CreateObject("ADODB.recordset")
RS1.CacheSize = 100
RS1.CursorType = adOpenStatic
RS1.LockType = adLockReadOnly

set RS1 = dbcmd.execute

arrResults = RS1.getrows

if (RS1.EOF = True) Then
        response.write "No Return Values!"
else
        response.write arrResults(0,0)
end if

%>

</body>
</html>

Quote:>-----Original Message-----
>Hao Deng

>have you defined the ADO constants that you are using.  
For instance,
>adOpenStatic, adCmdText mean absolutely nothing in
VBScript unless you
>explicitly set them -- unless you are in an ASP

environment and have
>explicitly referenced a type library or included the
adovbs.inc file.

>If you are using VBScript in a standalone environment,
you may need to
>include (as in copy and paste) the constant definitions
from:
>C:\Program Files\Common Files\System\ado\adovbs.inc

>regards
>roy fine



>> Hi,

>> I am experiencing some weird situation. The following
code
>> can be run successfully in Excel. But when I shift them
to
>> VBScript, I got an error message telling me "Unexpected
>> Error - Provider: Retrieving Data" on line of retrieving
>> recordset. And yes, I changed the syntax to clear the
>> difference beween VB and VBScript.

>> I checked status step by step and found the database is
>> opened conn.state = adStateOpen and dbcmd.state = 0. So
I
>> am guessing there should be something wrong with the
>> recordset.

>> Since I am new to this area, could someone please help
>> with this?

>> The purpose of the following code is to get historical
>> data from SQL DB through a third party provider. The
>> format of the command is listed under .CommandText.

>> Thanks a lot in advance,

>> Hao Deng

>> Dim conn As ADODB.Connection
>> Dim dbcmd As ADODB.Command
>> Dim rs1 As ADODB.Recordset
>> Dim icols As Integer
>> Dim ws As Worksheet

>> Sub sub_test()

>> tagatom = "110AALI100SEL.PV/SIG"
>> ' tagatom = "SINE1.PV/SIG"
>> adate = "9/10/2002 9:15:00 AM"
>> dtime = "9/10/2002 10:00:00 AM"
>> suffixcode = "1"  ' 0=raw,
>> 1=avg,2=max,3=min,4=sum,5=int,6=range,7=first,8=last
>> Interval = "1"
>> IntervalUnit = "2"   '

1=sec,2=min,3=hour,4=day,5=week,6=month,7=year,8=shift,9=ha

- Show quoted text -

Quote:>> lfday,10=twomonth,11=quarter,12=halfyear

>> 'Create variables for ADO Connection and Resultset
>> Set dbcmd = CreateObject("ADODB.Command")
>> Set conn = CreateObject("ADODB.Connection")
>> conn.CursorLocation = adUseClient
>> conn.Mode = adModeRead
>> conn.Open ("Provider = MNT_Historian")

>> Set dbcmd.ActiveConnection = conn
>> dbcmd.CommandType = adCmdText
>> ' dbcmd.CommandType = adRowset
>> dbcmd.CommandText = tagatom & "," & adate & "," & dtime
>> & "," & suffixcode & "," & Interval & "," & IntervalUnit
>> ' dbcmd.Execute
>> dbcmd.CommandTimeout = 180

>> Set rs1 = CreateObject("ADODB.recordset")
>> rs1.CacheSize = 100
>> rs1.CursorType = adOpenStatic
>> rs1.LockType = adLockReadOnly

>> rs1.Open dbcmd

>> ' arrResults = rs1.GetRows

>> Set ws = Excel.ActiveSheet
>> ws.Cells.ClearContents
>> ws.Cells.ClearFormats

>> If (rs1.EOF = True) Then
>>     Debug.Print "No Return Values!"
>> Else
>>     For icols = 0 To rs1.Fields.Count - 1
>>         ws.Cells(7, icols + 1).Value = rs1.Fields
>> (icols).Name
>>         Next

>>         ws.Range("A3") = "TagAtom:"
>>         ws.Range("B3") = tagatom

>>         ws.Range("A8").CopyFromRecordset rs1

>>         ws.Columns("A").NumberFormat = "mm/dd/yyyy
h:mm:ss
>> AM/PM"
>>         ws.Columns.AutoFit

>> End If

>>     rs1.Close
>>     Set rs1 = Nothing

>> End Sub

>.

 
 
 

VBA Code vs. VBScript Code

Post by Roy Fin » Sat, 14 Sep 2002 23:24:53


Hao Deng

It looks as if you are using a stored procedure, but you specified
adCmdText.  Have you tried using adCmdStoredProc instead..

Something like this:
dbcmd.CommandType = adCmdStoredProc

How are the parameters to the stored proc defined?

Considering this:

Quote:> dbcmd.CommandText = tagatom & "," & adate & "," & dtime
> & "," & suffixcode & "," & Interval & "," & IntervalUnit

 will get expanded to this:
"110AALI100SEL.PV/SIG,9/10/2002 9:15:00 AM,9/10/2002 10:00:00 AM,1,2,3"

that does not look like valid syntax to me.

regards
roy fine


Quote:> Hi,

> I am experiencing some weird situation. The following code
> can be run successfully in Excel. But when I shift them to
> VBScript, I got an error message telling me "Unexpected
> Error - Provider: Retrieving Data" on line of retrieving
> recordset. And yes, I changed the syntax to clear the
> difference beween VB and VBScript.

> I checked status step by step and found the database is
> opened conn.state = adStateOpen and dbcmd.state = 0. So I
> am guessing there should be something wrong with the
> recordset.

> Since I am new to this area, could someone please help
> with this?

> The purpose of the following code is to get historical
> data from SQL DB through a third party provider. The
> format of the command is listed under .CommandText.

> Thanks a lot in advance,

> Hao Deng

> Dim conn As ADODB.Connection
> Dim dbcmd As ADODB.Command
> Dim rs1 As ADODB.Recordset
> Dim icols As Integer
> Dim ws As Worksheet

> Sub sub_test()

> tagatom = "110AALI100SEL.PV/SIG"
> ' tagatom = "SINE1.PV/SIG"
> adate = "9/10/2002 9:15:00 AM"
> dtime = "9/10/2002 10:00:00 AM"
> suffixcode = "1"  ' 0=raw,
> 1=avg,2=max,3=min,4=sum,5=int,6=range,7=first,8=last
> Interval = "1"
> IntervalUnit = "2"   '
> 1=sec,2=min,3=hour,4=day,5=week,6=month,7=year,8=shift,9=ha
> lfday,10=twomonth,11=quarter,12=halfyear

> 'Create variables for ADO Connection and Resultset
> Set dbcmd = CreateObject("ADODB.Command")
> Set conn = CreateObject("ADODB.Connection")
> conn.CursorLocation = adUseClient
> conn.Mode = adModeRead
> conn.Open ("Provider = MNT_Historian")

> Set dbcmd.ActiveConnection = conn
> dbcmd.CommandType = adCmdText
> ' dbcmd.CommandType = adRowset
> dbcmd.CommandText = tagatom & "," & adate & "," & dtime
> & "," & suffixcode & "," & Interval & "," & IntervalUnit
> ' dbcmd.Execute
> dbcmd.CommandTimeout = 180

> Set rs1 = CreateObject("ADODB.recordset")
> rs1.CacheSize = 100
> rs1.CursorType = adOpenStatic
> rs1.LockType = adLockReadOnly

> rs1.Open dbcmd

> ' arrResults = rs1.GetRows

> Set ws = Excel.ActiveSheet
> ws.Cells.ClearContents
> ws.Cells.ClearFormats

> If (rs1.EOF = True) Then
>     Debug.Print "No Return Values!"
> Else
>     For icols = 0 To rs1.Fields.Count - 1
>         ws.Cells(7, icols + 1).Value = rs1.Fields
> (icols).Name
>         Next

>         ws.Range("A3") = "TagAtom:"
>         ws.Range("B3") = tagatom

>         ws.Range("A8").CopyFromRecordset rs1

>         ws.Columns("A").NumberFormat = "mm/dd/yyyy h:mm:ss
> AM/PM"
>         ws.Columns.AutoFit

> End If

>     rs1.Close
>     Set rs1 = Nothing

> End Sub

 
 
 

VBA Code vs. VBScript Code

Post by Hao Den » Sat, 14 Sep 2002 23:29:55


Hi Roy,

No. We are not using a SP. Instead we are using a
customized provider that generated by our supplier instead
of MS's standard "sqloledb".

The syntax listed below can be run from the rowsetviewer
using ICommand. But we are now seeking to put them on the
web.

Sorry for the confusion.

Hao Deng

>-----Original Message-----
>Hao Deng

>It looks as if you are using a stored procedure, but you
specified
>adCmdText.  Have you tried using adCmdStoredProc instead..

>Something like this:
>dbcmd.CommandType = adCmdStoredProc

>How are the parameters to the stored proc defined?

>Considering this:
>> dbcmd.CommandText = tagatom & "," & adate & "," & dtime
>> & "," & suffixcode & "," & Interval & "," & IntervalUnit

> will get expanded to this:
>"110AALI100SEL.PV/SIG,9/10/2002 9:15:00 AM,9/10/2002
10:00:00 AM,1,2,3"

>that does not look like valid syntax to me.

>regards
>roy fine



>> Hi,

>> I am experiencing some weird situation. The following
code
>> can be run successfully in Excel. But when I shift them
to
>> VBScript, I got an error message telling me "Unexpected
>> Error - Provider: Retrieving Data" on line of retrieving
>> recordset. And yes, I changed the syntax to clear the
>> difference beween VB and VBScript.

>> I checked status step by step and found the database is
>> opened conn.state = adStateOpen and dbcmd.state = 0. So
I
>> am guessing there should be something wrong with the
>> recordset.

>> Since I am new to this area, could someone please help
>> with this?

>> The purpose of the following code is to get historical
>> data from SQL DB through a third party provider. The
>> format of the command is listed under .CommandText.

>> Thanks a lot in advance,

>> Hao Deng

>> Dim conn As ADODB.Connection
>> Dim dbcmd As ADODB.Command
>> Dim rs1 As ADODB.Recordset
>> Dim icols As Integer
>> Dim ws As Worksheet

>> Sub sub_test()

>> tagatom = "110AALI100SEL.PV/SIG"
>> ' tagatom = "SINE1.PV/SIG"
>> adate = "9/10/2002 9:15:00 AM"
>> dtime = "9/10/2002 10:00:00 AM"
>> suffixcode = "1"  ' 0=raw,
>> 1=avg,2=max,3=min,4=sum,5=int,6=range,7=first,8=last
>> Interval = "1"
>> IntervalUnit = "2"   '

1=sec,2=min,3=hour,4=day,5=week,6=month,7=year,8=shift,9=ha

- Show quoted text -

Quote:>> lfday,10=twomonth,11=quarter,12=halfyear

>> 'Create variables for ADO Connection and Resultset
>> Set dbcmd = CreateObject("ADODB.Command")
>> Set conn = CreateObject("ADODB.Connection")
>> conn.CursorLocation = adUseClient
>> conn.Mode = adModeRead
>> conn.Open ("Provider = MNT_Historian")

>> Set dbcmd.ActiveConnection = conn
>> dbcmd.CommandType = adCmdText
>> ' dbcmd.CommandType = adRowset
>> dbcmd.CommandText = tagatom & "," & adate & "," & dtime
>> & "," & suffixcode & "," & Interval & "," & IntervalUnit
>> ' dbcmd.Execute
>> dbcmd.CommandTimeout = 180

>> Set rs1 = CreateObject("ADODB.recordset")
>> rs1.CacheSize = 100
>> rs1.CursorType = adOpenStatic
>> rs1.LockType = adLockReadOnly

>> rs1.Open dbcmd

>> ' arrResults = rs1.GetRows

>> Set ws = Excel.ActiveSheet
>> ws.Cells.ClearContents
>> ws.Cells.ClearFormats

>> If (rs1.EOF = True) Then
>>     Debug.Print "No Return Values!"
>> Else
>>     For icols = 0 To rs1.Fields.Count - 1
>>         ws.Cells(7, icols + 1).Value = rs1.Fields
>> (icols).Name
>>         Next

>>         ws.Range("A3") = "TagAtom:"
>>         ws.Range("B3") = tagatom

>>         ws.Range("A8").CopyFromRecordset rs1

>>         ws.Columns("A").NumberFormat = "mm/dd/yyyy
h:mm:ss
>> AM/PM"
>>         ws.Columns.AutoFit

>> End If

>>     rs1.Close
>>     Set rs1 = Nothing

>> End Sub

>.

 
 
 

VBA Code vs. VBScript Code

Post by Scot Ro » Wed, 18 Sep 2002 23:26:14


set rs1=dbcmd.Execute

 Or do a RS.Open...

See if that makes any difference..

Scot Rose, MCSD
Microsoft Visual Basic Developer Support

Want to know more? Check out the MSDN at msdn.microsoft.com or the Microsoft Knowledge Base at support.microsoft.com

This posting is provided AS IS, with no warranties, and confers no rights.

--------------------

>Content-Class: urn:content-classes:message


>Subject: VBA Code vs. VBScript Code
>Date: Fri, 13 Sep 2002 05:44:21 -0700
>Lines: 100

>MIME-Version: 1.0
>Content-Type: text/plain;
>    charset="iso-8859-1"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Thread-Index: AcJbI0hL/Ibwg7OgRbeF8oZcDZ/lhQ==
>X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
>Newsgroups: microsoft.public.data.ado
>NNTP-Posting-Host: TKMSFTNGXA09 10.201.226.37
>Path: cpmsftngxa10!cpmsftngxa08
>Xref: cpmsftngxa10 microsoft.public.data.ado:51431
>X-Tomcat-NG: microsoft.public.data.ado

>Hi,

>I am experiencing some weird situation. The following code
>can be run successfully in Excel. But when I shift them to
>VBScript, I got an error message telling me "Unexpected
>Error - Provider: Retrieving Data" on line of retrieving
>recordset. And yes, I changed the syntax to clear the
>difference beween VB and VBScript.

>I checked status step by step and found the database is
>opened conn.state = adStateOpen and dbcmd.state = 0. So I
>am guessing there should be something wrong with the
>recordset.

>Since I am new to this area, could someone please help
>with this?

>The purpose of the following code is to get historical
>data from SQL DB through a third party provider. The
>format of the command is listed under .CommandText.

>Thanks a lot in advance,

>Hao Deng

>Dim conn As ADODB.Connection
>Dim dbcmd As ADODB.Command
>Dim rs1 As ADODB.Recordset
>Dim icols As Integer
>Dim ws As Worksheet

>Sub sub_test()

>tagatom = "110AALI100SEL.PV/SIG"
>' tagatom = "SINE1.PV/SIG"
>adate = "9/10/2002 9:15:00 AM"
>dtime = "9/10/2002 10:00:00 AM"
>suffixcode = "1"  ' 0=raw,
>1=avg,2=max,3=min,4=sum,5=int,6=range,7=first,8=last
>Interval = "1"
>IntervalUnit = "2"   '
>1=sec,2=min,3=hour,4=day,5=week,6=month,7=year,8=shift,9=ha
>lfday,10=twomonth,11=quarter,12=halfyear

>'Create variables for ADO Connection and Resultset
>Set dbcmd = CreateObject("ADODB.Command")
>Set conn = CreateObject("ADODB.Connection")
>conn.CursorLocation = adUseClient
>conn.Mode = adModeRead
>conn.Open ("Provider = MNT_Historian")

>Set dbcmd.ActiveConnection = conn
>dbcmd.CommandType = adCmdText
>' dbcmd.CommandType = adRowset
>dbcmd.CommandText = tagatom & "," & adate & "," & dtime
>& "," & suffixcode & "," & Interval & "," & IntervalUnit
>' dbcmd.Execute
>dbcmd.CommandTimeout = 180

>Set rs1 = CreateObject("ADODB.recordset")
>rs1.CacheSize = 100
>rs1.CursorType = adOpenStatic
>rs1.LockType = adLockReadOnly

>rs1.Open dbcmd

>' arrResults = rs1.GetRows

>Set ws = Excel.ActiveSheet
>ws.Cells.ClearContents
>ws.Cells.ClearFormats

>If (rs1.EOF = True) Then
>    Debug.Print "No Return Values!"
>Else
>    For icols = 0 To rs1.Fields.Count - 1
>        ws.Cells(7, icols + 1).Value = rs1.Fields
>(icols).Name
>        Next

>        ws.Range("A3") = "TagAtom:"
>        ws.Range("B3") = tagatom

>        ws.Range("A8").CopyFromRecordset rs1

>        ws.Columns("A").NumberFormat = "mm/dd/yyyy h:mm:ss
>AM/PM"
>        ws.Columns.AutoFit

>End If

>    rs1.Close
>    Set rs1 = Nothing

>End Sub

 
 
 

1. VB code vs VBA code

I need to perform several tasks against Office 2000 products from a VB6
app. I am able to locate examples of VBA code to accomplish many of
these but I am not sure how to code the same thing in plain VB (Not
VBA). For example, to import data from a spreadsheet into an Access
table in VBA I can use:

DoCmd.TransferSpreadsheet _
  TransferType:=acImport, _
  SpreadsheetType:=5, _
  TableName :="tblSample", _
  FileName:="c:\mystuff\goodstuff.xls", _
  HasFieldNames;=True

What is the right way to code this in plain VB?

TIA

Wayne

2. Recordset with "Shape" command doesn't allow me to add new record

3. NEW VB, VBScript, ASP and VBA Source code and Controls

4. SQL cert question

5. System ODBC parameter in VBA code gives 3423 run-time error code

6. Running a Unix command from Oracle 8.0

7. Newbie Script ?: Using VBScript Classes or Calling Stored Procedures (How to Reuse Code within VBScript)

8. Dynamic SQL error

9. What is better, Load VB Code vs Executing Package with VB Code

10. Query code vs. program code question

11. Find zip codes (and things with zip codes) within a radius of a zip code

12. what is wrong with this simple vbscript code?

13. DTS Wizard and VBScript - Where is the code????