Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
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 February 10th, 2004, 05:22 PM
Registered User
 
Join Date: Feb 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to nimarii Send a message via Yahoo to nimarii
Default referencing a subform, more complex than it sounds

i'm trying to reference a subform, and i keep getting errors no matter what i try. they either can't find the subform, or the field i'm referencing.

What I'm trying to do is be able to "attach" a document on the user's machine to a table via a command button on a form. It should also be able to "Edit" existing attachments to change the name or path.

I have a button on a subform(f_orders_sub) that is linked to a text box where the attachment will show up. When the button is clicked, it will call the hyperlinkForm (completely separate form), which has a control that points to the attachment textbox. Everything works except for pointing the control to the textbox on the subform (should be marked in red)

Here's the partial code:
Option Compare Database
Option Explicit
Dim m_ctlHyperlink As Control

Private Sub form_load()
Set m_ctlHyperlink = Forms!f_order_details_form.Form.Controls(OpenArgs)
With m_ctlHyperlink.Hyperlink
    txtDisplay = .TextToDisplay
    txtAddress = .Address
    txtSubAddress = .SubAddress
End With
End Sub

Any help would be greatly appreciated!!

 
Old February 11th, 2004, 06:35 PM
Registered User
 
Join Date: Feb 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to nimarii Send a message via Yahoo to nimarii
Default

i found out how to do it; this is how you would refer to it:
forms!NameOfMainForm!NameOfControlThatHoldsTheSubf orm.form!Control
or
forms!NameOfMainForm!NameOfControlThatHoldsTheSubf orm.form.Property
i was confused because the control that holds the subform is not the tab that it was on, or the page it was on, but totally separate. i had to click off, then right click on the subform to get the control name, which was different from the subform name.







Similar Threads
Thread Thread Starter Forum Replies Last Post
Referencing a subform scandalous Access 2 March 16th, 2007 07:05 AM
Sights and Sounds in Access Forms SerranoG Access 1 October 11th, 2005 09:56 AM
Request: Sounds for Active Topics Snib Forum and Wrox.com Feedback 2 April 9th, 2004 04:11 PM
Sounds in Excel VBA selbybrock Wrox Book Feedback 0 December 13th, 2003 02:14 PM
Sounds in excel vba selbybrock Excel VBA 0 October 24th, 2003 09:42 AM





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