Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > BOOK: Access 2010 VBA Programmer's Reference
|
BOOK: Access 2010 VBA Programmer's Reference
This is the forum to discuss the Wrox book Access 2010 Programmer's Reference by Teresa Hennig, Rob Cooper, Geoffrey L. Griffith, Jerry Dennison; ISBN: 978-0-470-59166-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Access 2010 VBA Programmer's Reference 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 May 13th, 2012, 02:52 PM
Authorized User
 
Join Date: Jun 2006
Posts: 73
Thanks: 1
Thanked 1 Time in 1 Post
Default Setting 'Source Object' property of subform at Runtime ?

It appears I can set the 'Source Object' property of a subform at design time ( i.e Query.qryReferralsByClient ) but I would like to override this at runtime, and pass my query a variable using WHERE clause( WHERE Client_ID='4' for example ) How do I do this ?
 
Old May 13th, 2012, 05:47 PM
Authorized User
 
Join Date: Oct 2010
Posts: 64
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Can't you just use the Link Master and Link Child field options? I'm assuming the main form recordset has a field with the Client_ID value and when you move through this recordset you want to display the relevant referrals from your qryReferralsByClient query in the subform!
 
Old May 16th, 2012, 02:27 PM
Authorized User
 
Join Date: Jun 2006
Posts: 73
Thanks: 1
Thanked 1 Time in 1 Post
Default

Thank you. I'm about to try that ( again ).
 
Old May 16th, 2012, 02:38 PM
Authorized User
 
Join Date: Jun 2006
Posts: 73
Thanks: 1
Thanked 1 Time in 1 Post
Default

It says it 'can't build a link between unbound forms' ( I'm using a DoCmd method in the VBA code) for the main form. I know wehn you use the wizard it 'links the Main Form and subform at design time, but I need more flexibility over the recordsets. Hope this makes sense. Here's the main form's code ...

DoCmd.OpenForm "frmAfAIS(test)", , qrySelectClientsByAdvocate, "Advocate_ID=" & rs.Fields("Advocate_ID")

This loads the required records, I now wish to select only records based on a common field 'Client_ID' to both recordsets ( which doesn't actually show on the form ) to display in the subform datasheet view. Thanks.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Object Data Source class property Colonel Angus ASP.NET 2.0 Professional 5 March 17th, 2008 03:21 PM
setting subform to new record skinny Access 4 January 3rd, 2006 02:57 PM
Runtime property sonurijs ASP.NET 1.0 and 1.1 Professional 0 September 22nd, 2005 11:44 PM
create a Line object ,Box object in CR at Runtime? thanhnt Pro VB 6 1 May 16th, 2005 06:51 AM
Subform - Dynamically Setting mnoon Access 14 March 13th, 2005 07:33 PM





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