Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA 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 January 9th, 2006, 12:42 PM
Registered User
 
Join Date: Jan 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Report from disconnected recordset

Hi,
I have a FE with all my forms and a BE with all my tables. The forms in the FE create disconnected recordsets from the BE for data entry and manipulation. How can I get a report that resides in the FE to use the local disconnected data, rather than having to copy the table from the BE and deleting it again after?
Thanks for your help.
 
Old January 9th, 2006, 02:46 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

It sounds like your backend is a .mdb, in which case you'd probably need to create a local, temporary table in the FE based on a stored temp table template for your report (you can do this in code), open an empty recordset based on your temp table, transfer the data from your disconnected recordset into the temp table, then use the temp table as the RecordSource property for your report. I don't think you can use a report object's Recordset property to bind to a recordset in a .mdb, but I could be wrong.

Bob

 
Old January 9th, 2006, 03:10 PM
Registered User
 
Join Date: Jan 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Bob,
you are correct, the back end is an .mdb. I will give your solution a try. Since I am not that proficient in my coding yet, it might take a bit. I will let you know how I made out.
Thanks.
 
Old January 9th, 2006, 04:15 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

You can create a query in the BE to limit the recordset that you need for your report, and then just transfer the results of the query. This will keep the wire cool.

You would do something like:
'---------------------------
DoCmd.SetWarnings False
DoCmd.RunQuery "qryDELETEfromYourTable"
DoCmd.TransferDatabase transfertype:=acImport, _
     databasetype:="Microsoft Access", _
     databasename:="Z:\Data\Database_be.mdb", _
     objecttype:=acTable, Source:="qryYourQuery", _
     Destination:="tblYourTable"
DoCmd.SetWarnings True
'---------------------------

DoCmd.SetWarnings False turns off your application warnings for the Delete query coming up.
The Delete query empties the local table for new data. You have to build the delete query yourself.
DoCmd.TransferDatabase takes the results of the query on your back end, and shoves it into your local table that you just cleaned out. This is the temp table, but not really since it is permanent.
DoCmd.SetWarnings True turns your warnings back on.

HTH


mmcdonal
 
Old January 9th, 2006, 04:26 PM
Registered User
 
Join Date: Jan 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the great help. I will keep you posted on the results.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Dcount with local disconnected recordset DreamEagl Access VBA 7 March 10th, 2006 01:44 PM
VB Collection object Vs Disconnected Recordset Andypat Pro VB Databases 1 February 15th, 2005 06:57 PM
Getting to the recordset in report header badgolfer Access 3 June 16th, 2004 11:35 AM
Recordset to sub report razia VB Databases Basics 0 April 23rd, 2004 06:44 AM





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