Re: Access can't find the field referenced in your expression



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/AwUBSfIktYechKqOuFEgEQJRUgCggcYi8ef5nzTP7uxWbejIf9kbA3AAoJWx
NXNHo/LX0NPxaU2tnimFugLc
=vNa3
-----END PGP SIGNATURE-----
.



Relevant Pages

  • Re: CreateEventProc error
    ... Private Sub BuildDisplayForm(strPath As String, ... Dim qdf As QueryDef, qdfControls As QueryDef ... Dim ctl As Control, ctlLabel As Control, ctlParent As Control ... Dim strFilter As String, strSuffix As String, strParentName As String, ...
    (microsoft.public.access.forms)
  • Re: hyperlinks in a paragraph
    ... Public Sub Discover(ByVal MStr As String) ... Public Sub ProcPara ... Dim HL As Hyperlink ...
    (microsoft.public.word.vba.general)
  • Re: Updating Hyperlinks with VBA
    ... macros involve open and close those files with hyperlink. ... Dim MyPath As String ... Dim Currfile As String ... Dim fCtr As Long ...
    (microsoft.public.excel.misc)
  • Re: QBF on Steroids with List Control --almost there, but problem
    ... > there is an error thrown whenever I select from the list control. ... > ByVal strFieldName As String, ... > Dim strTemp As String ... > Dim strLocalSQL As String ...
    (microsoft.public.access.formscoding)
  • RE: Audit Log
    ... strFormName As String, _ ... Dim dbs As DAO.Database ... Dim ctlCtrl As Control ...
    (microsoft.public.access.modulesdaovba)