Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 11th, 2006, 08:05 PM
Registered User
 
Join Date: Sep 2006
Location: Rockdale, NSW, Australia.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Linking an unbound subform

I know this is probably not the best plan, but I need to link an unbound subform to some values contained in a listbox selection on the main form. The reason why I am using an unbound subform is that I want to control how the user adds/edits/navigates the records (using proper command controls).

I would like to link the subform programmatically to the main form (or the values selected in the list box). Based on the list box selection (and the values of Column(0) and Column(3)), the subform should be populated with the records from a table (tblOptions) containing fields with values equal to Column(0) and Column(3) (on the subform, it corresponds to txtExecID and txtCode).

I am currently doing this in DAO; I tried a few different things but none work.

Reply With Quote
  #2 (permalink)  
Old September 13th, 2006, 12:27 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Don't quote me, but I think a Master/Child link on a form/subform will only take one column.

Double click the subform in design view and select the data tab, then select the Master and Child fields you want to use.

You alternative is to code this OR use a query with criteria that look to the controls on your main form.

So the query behind your subform with have this as criteria for txtExecID:
[Forms]![frmMainFormName].[txtExecID]

And the txtCode field in the query would have this criteria:
[Forms]![frmMainFormName].[txtCode]

For both of these, they may be referencing columns in the text box or combo box you are using.

The thing is, doing it this way means that only records that satisfy both field values will be returned.

Do you have more info?




mmcdonal
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Subform linking problem JimTate BOOK: Access 2007 VBA Programmer's Reference ISBN: 978-0-470-04703-3 0 April 22nd, 2008 11:07 AM
filtering records on subform from an unbound combo jd_erd Access 3 February 12th, 2007 11:21 PM
unbound field in subform chacquard Access VBA 4 February 7th, 2007 10:01 AM
Filter Subform B Based on Field in Subform A SerranoG Access VBA 3 June 18th, 2004 12:23 AM
Linking Subform using ADO Skharva Access 1 January 13th, 2004 12:27 AM



All times are GMT -4. The time now is 03:11 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.