Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Connection to Access fails

Reply
 
Old 10-02-2008   #1 (permalink)
JT


 
 

Connection to Access fails

Hi

I'm testing a connection to an Access database and looking up a filename
in a column but I keep getting an error with the following code :

Line3 Char5 - Object doesn't support this property or method
:'oCmd.Connection'


Function DoExecSQL(SQL,Params,Opt)
Set oCmd = CreateObject("ADODB.Command")
Set oCmd.Connection = oConn
oCmd.CommandText = SQL
Set DoExecSQL = oCmd.Execute(, Params, Opt)
End Function

Function ExecSQL(SQL, Params)
Set ExecSQL = DoExecSQL(SQL, Params, 0)
End Function

Function ExecSQLNoResults(SQL, Params)
Set ExecSQL = DoExecSQL(SQL, Params, 128)
End Function

Function GetDocumentFlag(Doc)
Set oRs = ExecSQL("SELECT * FROM FLAG WHERE FILENAME=?", Array(Doc))
If NOT oRs.EOF Then
GetDocumentFlag = oRs("FLAG").Value
Else
GetDocumentFlag = 0
End If
End Function

Set oConn = CreateObject("ADODB.Connection")

oConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\test.mdb;Persist Security Info=False"

oConn.Open


If GetDocumentFlag("thefilename") = True Then
MsgBox "found filename"
Else
MsgBox "not found filename"
End If

I'm not sure why the error - any thoughts ?

Thanks

JT

My System SpecsSystem Spec
Old 10-02-2008   #2 (permalink)
ekkehard.horner


 
 

Re: Connection to Access fails

JT schrieb:
Quote:

> Hi
>
> I'm testing a connection to an Access database and looking up a filename
> in a column but I keep getting an error with the following code :
>
> Line3 Char5 - Object doesn't support this property or method
> :'oCmd.Connection'
>
>
> Function DoExecSQL(SQL,Params,Opt)
> Set oCmd = CreateObject("ADODB.Command")
> Set oCmd.Connection = oConn
> oCmd.CommandText = SQL
> Set DoExecSQL = oCmd.Execute(, Params, Opt)
> End Function
[...]
Set oCmd.ActiveConnection = oConn
My System SpecsSystem Spec
Old 10-03-2008   #3 (permalink)
JT


 
 

Re: Connection to Access fails

thanks!

ekkehard.horner wrote:
Quote:

> JT schrieb:
Quote:

>> Hi
>>
>> I'm testing a connection to an Access database and looking up a
>> filename in a column but I keep getting an error with the following
>> code :
>>
>> Line3 Char5 - Object doesn't support this property or method
>> :'oCmd.Connection'
>>
>>
>> Function DoExecSQL(SQL,Params,Opt)
>> Set oCmd = CreateObject("ADODB.Command")
>> Set oCmd.Connection = oConn
>> oCmd.CommandText = SQL
>> Set DoExecSQL = oCmd.Execute(, Params, Opt)
>> End Function
> [...]
> Set oCmd.ActiveConnection = oConn
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Email access OK but Web access fails Network & Sharing
Fails to detect internet connection Network & Sharing
Network Connection Fails from One Laptop but not the other Vista networking & sharing
VPN connection was working, now fails with error 651 Vista networking & sharing
Internet Connection fails afer about 60 mins Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46