Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 16th, 2003, 02:46 PM
Authorized User
 
Join Date: Sep 2003
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am using the correct one lines from the saved query to construct the record set. And even though it works fine from the Qeury designer, it won't work from VBA for some reason.

Did you say there was a way to get the recordset from the saved query directly and use it in VBA? I can't seem to find any information on that. Could you elaborate on that?

-Roni

Roni Estein
Roni.Estein@e-drugscanada.com
https://www.e-drugsCanada.com
 
Old October 16th, 2003, 03:38 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default


    Dim rstAuthors As ADODB.Recordset
    Dim strCnn As String
    Dim strMessage As String
    Dim intCommand As Integer

    ' Open recordset from Authors table.
        strCnn = currentproject.connection

    Set rstAuthors = New ADODB.Recordset
    rstAuthors.CursorType = adOpenStatic
    ' Use client cursor to enable AbsolutePosition property.
    rstAuthors.CursorLocation = adUseClient
    rstAuthors.Open "Authors", strCnn, , , adCmdTable

"Authors" is a table name, but you can use a query.

Dim cn As ADODB.Connection
   Set cn = CurrentProject.Connection

   Dim rs As New ADODB.Recordset
   'open the greenridge export query
   rs.Open "Authors", cn, adOpenForwardOnly, adLockOptimistic


Sal
 
Old October 16th, 2003, 04:02 PM
Authorized User
 
Join Date: Sep 2003
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Sal,

Thank you so much, I don't know how you fiind the time to contribute so rapidly like this.

Much appreciated
-Roni

Roni Estein
Roni.Estein@e-drugscanada.com
https://www.e-drugsCanada.com
 
Old October 16th, 2003, 04:05 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There is not much work today

Sal





Similar Threads
Thread Thread Starter Forum Replies Last Post
automate the fields anukagni Access 3 February 12th, 2007 08:45 AM
automate connection wizard olambe VB How-To 2 May 5th, 2005 03:54 PM
How to automate import with notepad timoma Access 20 February 11th, 2005 03:03 PM
Automate Export of Comma-Delineated file > Access? darinsee Access 1 February 10th, 2004 09:57 PM
Automate Queries Ben Access VBA 3 January 29th, 2004 08:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.