![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a main form "Main" and a sub form "Sub" - the subform contains a list of relevant documents that I might want to associate with a record in the form on Main. These documents are contained in a table and include a field that has a hyperlink to them. I'm trying to use the AfterUpdate event - after the user selects a document from the dropdown list, I want the form to automatically copy in the hyperlink. Private Sub Document_AfterUpdate() Dim stDocName As String Dim stLinkCriteria As String '[fx-get document] is a form created just for accessing the documents in their table stDocName = "fx - get document" stLinkCriteria = "[evTitle]=" & "'" & Me![Evidence] & "'" DoCmd.OpenForm stDocName, , , stLinkCriteria Dim doc_location As String 'DM_Other_Location contains the hyperlink <<<< it breaks here - can't find DM_Other_Location doc_location = Forms![fx - get document]!DM_Other_Location.Text DoCmd.Close 'Now put the hyperlink into the desired field Forms![analysis-document subform]!Location.SetFocus Forms![analysis-document subform]!Location.Text = doc_location End Sub |
#3
| |||
| |||
|
|
MPS wrote: I have a main form "Main" and a sub form "Sub" - the subform contains a list of relevant documents that I might want to associate with a record in the form on Main. *These documents are contained in a table and include a field that has a hyperlink to them. I'm trying to use the AfterUpdate event - after the user selects a document from the dropdown list, I want the form to automatically copy in the hyperlink. Private Sub Document_AfterUpdate() * * Dim stDocName As String * * Dim stLinkCriteria As String * * '[fx-get document] is a form created just for accessing the documents in their table * * stDocName = "fx - get document" * * stLinkCriteria = "[evTitle]=" & "'" & Me![Evidence] & "'" * * DoCmd.OpenForm stDocName, , , stLinkCriteria * * Dim doc_location As String * * 'DM_Other_Location contains the hyperlink * * *<<<< it breaks here - can't find DM_Other_Location * * doc_location = Forms![fx - get document]!DM_Other_Location.Text * * DoCmd.Close * * 'Now put the hyperlink into the desired field * * Forms![analysis-document subform]!Location.SetFocus * * Forms![analysis-document subform]!Location.Text = doc_location * * End Sub -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Make sure you're spelling the control's name correctly. *I just copy the * name from the Control's Name property and paste it into my VBA code to be sure. *You don't need to use the .Text property when assigning a value to the control. *In Access VBA the default is .Value. *The .Text property is the display field of the control. -- MGFoster:::mgf00 <at> earthlink <decimal-point> net Oakland, CA (USA) ** Respond only to this newsgroup. *I DO NOT respond to emails ** -----BEGIN PGP SIGNATURE----- Version: PGP for Personal Privacy 5.0 Charset: noconv iQA/AwUBSfIktYechKqOuFEgEQJRUgCggcYi8ef5nzTP7uxWbejIf9 kbA3AAoJWx NXNHo/LX0NPxaU2tnimFugLc =vNa3 -----END PGP SIGNATURE------ Hide quoted text - - Show quoted text - |
#4
| |||
| |||
|
|
I hope this isn't a silly next comment - is it significant that the actual name of the field I"m trying to access is "DM/Other Location" ? It was Access that gave me the DM_Other_Location syntax. On Apr 24, 4:44 pm, MGFoster <m... (AT) privacy (DOT) com> wrote: MPS wrote: I have a main form "Main" and a sub form "Sub" - the subform contains a list of relevant documents that I might want to associate with a record in the form on Main. These documents are contained in a table and include a field that has a hyperlink to them. I'm trying to use the AfterUpdate event - after the user selects a document from the dropdown list, I want the form to automatically copy in the hyperlink. Private Sub Document_AfterUpdate() Dim stDocName As String Dim stLinkCriteria As String '[fx-get document] is a form created just for accessing the documents in their table stDocName = "fx - get document" stLinkCriteria = "[evTitle]=" & "'" & Me![Evidence] & "'" DoCmd.OpenForm stDocName, , , stLinkCriteria Dim doc_location As String 'DM_Other_Location contains the hyperlink <<<< it breaks here - can't find DM_Other_Location doc_location = Forms![fx - get document]!DM_Other_Location.Text DoCmd.Close 'Now put the hyperlink into the desired field Forms![analysis-document subform]!Location.SetFocus Forms![analysis-document subform]!Location.Text = doc_location End Sub -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Make sure you're spelling the control's name correctly. I just copy the name from the Control's Name property and paste it into my VBA code to be sure. You don't need to use the .Text property when assigning a value to the control. In Access VBA the default is .Value. The .Text property is the display field of the control. -- MGFoster:::mgf00 <at> earthlink <decimal-point> net Oakland, CA (USA) ** Respond only to this newsgroup. I DO NOT respond to emails ** -----BEGIN PGP SIGNATURE----- Version: PGP for Personal Privacy 5.0 Charset: noconv iQA/AwUBSfIktYechKqOuFEgEQJRUgCggcYi8ef5nzTP7uxWbejIf9 kbA3AAoJWx NXNHo/LX0NPxaU2tnimFugLc =vNa3 -----END PGP SIGNATURE------ Hide quoted text - - Show quoted text - |
#5
| |||
| |||
|
|
I have a main form "Main" and a sub form "Sub" - the subform contains a list of relevant documents that I might want to associate with a record in the form on Main. These documents are contained in a table and include a field that has a hyperlink to them. I'm trying to use the AfterUpdate event - after the user selects a document from the dropdown list, I want the form to automatically copy in the hyperlink. Private Sub Document_AfterUpdate() Dim stDocName As String Dim stLinkCriteria As String '[fx-get document] is a form created just for accessing the documents in their table stDocName = "fx - get document" stLinkCriteria = "[evTitle]=" & "'" & Me![Evidence] & "'" DoCmd.OpenForm stDocName, , , stLinkCriteria Dim doc_location As String 'DM_Other_Location contains the hyperlink <<<< it breaks here - can't find DM_Other_Location doc_location = Forms![fx - get document]!DM_Other_Location.Text DoCmd.Close 'Now put the hyperlink into the desired field Forms![analysis-document subform]!Location.SetFocus Forms![analysis-document subform]!Location.Text = doc_location End Sub |
![]() |
| Thread Tools | |
| Display Modes | |
| |