|
Related Topics:
| ADO Connection Access Database VB - I have been accessing a database on a local drive thru an ADO The following is the code that I have been using. Security The problem is now I have..
Updating An ADO 2.6 Recordset With VB and Access - When I try to update my ADO Recordset like this: = I get this: Current Recordset does not support updating. This may be a of the provider, or of the selected locktype. Error 3251 When I try to..
Accessing a report made from MS Access using VB6. - Dear fellow With vb6, i am using MS Access as my database. I already made a lot of reports in the MS Access and i want to access that reports too in my vb6 program. My vb6 program should be able to view and print those MS Access ..
How do I run a report in Access from Visual Basic? - I have a report written in Access that is now working pretty well and I would like to include it in the VB that uses the Access database that the report is in. I have used VB to build the tables the report is based on and I would like to let..
runtime error 3021 and user permissions - I have a VB6 that uses ADO 2.7 to access an database. I have found on Windows XP and 2000, that if the user is not part of the group, they receive: error 3021. Either BOF or EOF is true, or the current record..
|
|
|
Next: Class name from a variable
|
| Author |
Message |
External

Since: Feb 18, 2005 Posts: 7
|
(Msg. 1) Posted: Fri Feb 18, 2005 6:40 am
Post subject: ado connections in access Archived from groups: microsoft>public>vb>database>ado (more info?)
|
|
|
Hi,
Is the following code correct to call the ado-connection from every form i
create. I'm getting errors if i execute it.
For testing purposes i used the code in the form's module and then it
worked, but not how i like it. The purpose of it, is to use connection
pooling.
Here is the code in the module:
option explicit
Dim cnn As ADODB.Connection
public sub ado_conn()
Set cnn = New ADODB.Connection
With cnn
.Provider = "sqloledb"
.Properties("Data Source") = "local"
.Properties("Initial Catalog") = "NEW"
.Properties("User ID") = "sa"
.Properties("Password") = "password"
End With
end sub
From the form onOpen event:
dim cnn as adodb.connection
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.CursorLocation = adUseClient
cnn.Open cnn
cnn.usp_search 7, Nz(Null, ""), rst 'this line calls a stored procedure
from a sql server database.
Set Forms("Form1").Recordset = rst
rst.Close
Set rst = Nothing
cnn.Close
Set cnn = Nothing >> Stay informed about: ado connections in access |
|
| Back to top |
|
 |  |
External

Since: Nov 21, 2004 Posts: 17
|
(Msg. 2) Posted: Fri Feb 18, 2005 6:51 am
Post subject: RE: ado connections in access [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Hi Jason,
It seems you’ve instantiated a global connection object, but then in the
form “Load?” (I assume this is what you mean when you mention the “onOpen
event”?) event you declare another connection object, however you don’t
instantiate this one, nor set any of its properties. Try getting rid of the
“dim cnn as adodb.connection” in the form load event; that way the global
connection you created in the module will be used as the connection.
Hope this helps
Ant >> Stay informed about: ado connections in access |
|
| Back to top |
|
 |  |
External

Since: Feb 04, 2004 Posts: 123
|
(Msg. 3) Posted: Fri Feb 18, 2005 11:40 am
Post subject: Re: ado connections in access [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Does the line:
cnn.usp_search
Cause the errors? There is no method called USP_SEARCH of the connection
object.
--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
<a style='text-decoration: underline;' href="http://www.veign.com/vrc_main.asp" target="_blank">http://www.veign.com/vrc_main.asp</a>
--
"Jason" <jlewis.RemoveThis@hotmail.com> wrote in message
news:%23%231NKKaFFHA.2832@TK2MSFTNGP14.phx.gbl...
> Hi,
>
> Is the following code correct to call the ado-connection from every form i
> create. I'm getting errors if i execute it.
> For testing purposes i used the code in the form's module and then it
> worked, but not how i like it. The purpose of it, is to use connection
> pooling.
>
> Here is the code in the module:
> option explicit
> Dim cnn As ADODB.Connection
>
> public sub ado_conn()
>
> Set cnn = New ADODB.Connection
>
> With cnn
> .Provider = "sqloledb"
> .Properties("Data Source") = "local"
> .Properties("Initial Catalog") = "NEW"
> .Properties("User ID") = "sa"
> .Properties("Password") = "password"
> End With
> end sub
>
> From the form onOpen event:
>
> dim cnn as adodb.connection
> Dim rst As ADODB.Recordset
>
> Set rst = New ADODB.Recordset
>
> rst.CursorLocation = adUseClient
> cnn.Open cnn
> cnn.usp_search 7, Nz(Null, ""), rst 'this line calls a stored
procedure
> from a sql server database.
>
> Set Forms("Form1").Recordset = rst
>
> rst.Close
>
> Set rst = Nothing
>
> cnn.Close
>
> Set cnn = Nothing
>
><!-- ~MESSAGE_AFTER~ --> >> Stay informed about: ado connections in access |
|
| Back to top |
|
 |  |
External

Since: Feb 18, 2005 Posts: 7
|
(Msg. 4) Posted: Fri Feb 18, 2005 9:27 pm
Post subject: Re: ado connections in access [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Hi,
usp_search is my own proc. The connection method can call procs like that.
"Veign" <NOSPAMinveign DeleteThis @veign.com> schreef in bericht
news:Og8RaEdFFHA.1396@tk2msftngp13.phx.gbl...
> Does the line:
> cnn.usp_search
>
> Cause the errors? There is no method called USP_SEARCH of the connection
> object.
>
> --
> Chris Hanscom - Microsoft MVP (VB)
> Veign's Resource Center
<font color=purple> > <a style='text-decoration: underline;' href="http://www.veign.com/vrc_main.asp</font" target="_blank">http://www.veign.com/vrc_main.asp</font</a>>
> --
>
> "Jason" <jlewis DeleteThis @hotmail.com> wrote in message
> news:%23%231NKKaFFHA.2832@TK2MSFTNGP14.phx.gbl...
>> Hi,
>>
>> Is the following code correct to call the ado-connection from every form
>> i
>> create. I'm getting errors if i execute it.
>> For testing purposes i used the code in the form's module and then it
>> worked, but not how i like it. The purpose of it, is to use connection
>> pooling.
>>
>> Here is the code in the module:
>> option explicit
>> Dim cnn As ADODB.Connection
>>
>> public sub ado_conn()
>>
>> Set cnn = New ADODB.Connection
>>
>> With cnn
>> .Provider = "sqloledb"
>> .Properties("Data Source") = "local"
>> .Properties("Initial Catalog") = "NEW"
>> .Properties("User ID") = "sa"
>> .Properties("Password") = "password"
>> End With
>> end sub
>>
>> From the form onOpen event:
>>
>> dim cnn as adodb.connection
>> Dim rst As ADODB.Recordset
>>
>> Set rst = New ADODB.Recordset
>>
>> rst.CursorLocation = adUseClient
>> cnn.Open cnn
>> cnn.usp_search 7, Nz(Null, ""), rst 'this line calls a stored
> procedure
>> from a sql server database.
>>
>> Set Forms("Form1").Recordset = rst
>>
>> rst.Close
>>
>> Set rst = Nothing
>>
>> cnn.Close
>>
>> Set cnn = Nothing
>>
>>
>
><!-- ~MESSAGE_AFTER~ --> >> Stay informed about: ado connections in access |
|
| Back to top |
|
 |  |
External

Since: Feb 04, 2004 Posts: 123
|
(Msg. 5) Posted: Fri Feb 18, 2005 9:27 pm
Post subject: Re: ado connections in access [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
What line causes the error?
--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
<a style='text-decoration: underline;' href="http://www.veign.com/vrc_main.asp" target="_blank">http://www.veign.com/vrc_main.asp</a>
--
"Jason" <jlewis.TakeThisOut@hotmail.com> wrote in message
news:uOX1W$eFFHA.1936@TK2MSFTNGP14.phx.gbl...
> Hi,
>
> usp_search is my own proc. The connection method can call procs like that.
>
> "Veign" <NOSPAMinveign.TakeThisOut@veign.com> schreef in bericht
> news:Og8RaEdFFHA.1396@tk2msftngp13.phx.gbl...
> > Does the line:
> > cnn.usp_search
> >
> > Cause the errors? There is no method called USP_SEARCH of the
connection
> > object.
> >
> > --
> > Chris Hanscom - Microsoft MVP (VB)
> > Veign's Resource Center
<font color=green> > > <a style='text-decoration: underline;' href="http://www.veign.com/vrc_main.asp</font" target="_blank">http://www.veign.com/vrc_main.asp</font</a>>
> > --
> >
> > "Jason" <jlewis.TakeThisOut@hotmail.com> wrote in message
> > news:%23%231NKKaFFHA.2832@TK2MSFTNGP14.phx.gbl...
> >> Hi,
> >>
> >> Is the following code correct to call the ado-connection from every
form
> >> i
> >> create. I'm getting errors if i execute it.
> >> For testing purposes i used the code in the form's module and then it
> >> worked, but not how i like it. The purpose of it, is to use connection
> >> pooling.
> >>
> >> Here is the code in the module:
> >> option explicit
> >> Dim cnn As ADODB.Connection
> >>
> >> public sub ado_conn()
> >>
> >> Set cnn = New ADODB.Connection
> >>
> >> With cnn
> >> .Provider = "sqloledb"
> >> .Properties("Data Source") = "local"
> >> .Properties("Initial Catalog") = "NEW"
> >> .Properties("User ID") = "sa"
> >> .Properties("Password") = "password"
> >> End With
> >> end sub
> >>
> >> From the form onOpen event:
> >>
> >> dim cnn as adodb.connection
> >> Dim rst As ADODB.Recordset
> >>
> >> Set rst = New ADODB.Recordset
> >>
> >> rst.CursorLocation = adUseClient
> >> cnn.Open cnn
> >> cnn.usp_search 7, Nz(Null, ""), rst 'this line calls a stored
> > procedure
> >> from a sql server database.
> >>
> >> Set Forms("Form1").Recordset = rst
> >>
> >> rst.Close
> >>
> >> Set rst = Nothing
> >>
> >> cnn.Close
> >>
> >> Set cnn = Nothing
> >>
> >>
> >
> >
>
><!-- ~MESSAGE_AFTER~ --> >> Stay informed about: ado connections in access |
|
| Back to top |
|
 |  |
|