Feb 20, 2008 #1 terre Technical User Feb 2, 2003 97 AU The following code Dim Pth As String Dim frmName As String frmName = "DLO1" Pth = "C:\XXX" Forms!frmName![Photos].Form!PathtoDoc = "#" & Pth & "#" gives the error Cant find Form frmName What am I missing please?
The following code Dim Pth As String Dim frmName As String frmName = "DLO1" Pth = "C:\XXX" Forms!frmName![Photos].Form!PathtoDoc = "#" & Pth & "#" gives the error Cant find Form frmName What am I missing please?
Feb 20, 2008 #2 JoeAtWork Programmer Jul 31, 2005 2,285 CA More likely you want: Forms!DLO1!PathtoDoc = "#" & Pth & "#" If you want to reference forms with a variable, you can't use bang notation. Instead: Forms(frmName).Controls("PathtoDoc") = "#" & Pth & "#" Upvote 0 Downvote
More likely you want: Forms!DLO1!PathtoDoc = "#" & Pth & "#" If you want to reference forms with a variable, you can't use bang notation. Instead: Forms(frmName).Controls("PathtoDoc") = "#" & Pth & "#"
Feb 20, 2008 Thread starter #3 terre Technical User Feb 2, 2003 97 AU Thank You Joe Forms(frmName)![Photos].Form!PathtoDoc = "#" & Pth & "#" Works fine Upvote 0 Downvote
Feb 21, 2008 #4 BSman Programmer Apr 16, 2002 718 US If you are working in the subform, you can also reference a control in the main form like this: Me.Parent.PathtoDoc Bob Upvote 0 Downvote
If you are working in the subform, you can also reference a control in the main form like this: Me.Parent.PathtoDoc Bob
Feb 21, 2008 Thread starter #5 terre Technical User Feb 2, 2003 97 AU Thanks BSman The code is in a function.....and wont let me use Me.Parent And frmName is a variable ... as is PathToDoc But it works now....thanks muchly Upvote 0 Downvote
Thanks BSman The code is in a function.....and wont let me use Me.Parent And frmName is a variable ... as is PathToDoc But it works now....thanks muchly