Re: Passing form name to generalized procedure

From: Richard (richard_at_discussions.microsoft.com)
Date: 02/24/05


Date: Thu, 24 Feb 2005 08:31:03 -0800

Thanks for the help.

"Brendan Reynolds" wrote:

> I'm assuming this is an Access form?
>
> If so, an example would be ...
>
> Public Sub TestFormRef(ByVal strFormName As String, ByVal strControlName As
> String)
>
> Debug.Print Forms(strFormName).Controls(strControlName).Value
>
> End Sub
>
> Example of use in the Immediate window ...
>
> testformref "frmTest","TestText"
> My Test Text
>
> BTW: This question doesn't seem to have much to do with ADO, and might have
> been better asked in an Access newsgroup such as
> microsoft.public.access.formscoding
>
> --
> Brendan Reynolds (Access MVP)
>
> "Richard" <richard@discussions.microsoft.com> wrote in message
> news:06239396-DB72-4BDA-8CAA-B3F6A4610131@microsoft.com...
> >I have a generalized procedure to process data entered into text boxes, for
> > use with multiple forms. The name of the current form is passed as a
> > String
> > variable to the procedure. When the procedure attempts to use the
> > variable
> > to process a field ( i.e., Forms!frmNameVar(FieldName) ) an error message
> > says that the module "can't find the form 'frmNameVar' referred to " in
> > the
> > code. If I substitute the actual name of the calling form into the VBA
> > code,
> > the procedure works properly.
> >
> > How do I pass a form name to a generalized procedure and reference it to
> > process text fields that are in the form?
> >
> > Richard
>
>
>



Relevant Pages

  • Re: Passing form name to generalized procedure
    ... Public Sub TestFormRef(ByVal strFormName As String, ... "Richard" wrote in message ... > How do I pass a form name to a generalized procedure and reference it to ...
    (microsoft.public.data.ado)
  • Re: multiplatform (pocketPC & desktopPC) (Daniel !!)
    ... Friend Versione As String ... Public Sub GetMyConnectionPalmare() ... Dim errorMessages As String ... Private Function GetDS_Desktop(ByVal SQL As String) As DataSet ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: multiplatform (pocketPC & desktopPC) (Daniel !!)
    ... Friend Versione As String ... Public Sub GetMyConnectionPalmare() ... Dim errorMessages As String ... Private Function GetDS_Desktop(ByVal SQL As String) As DataSet ...
    (microsoft.public.dotnet.framework.compactframework)
  • 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: multiplatform (pocketPC & desktopPC) (Daniel !!)
    ... Friend Cn_SQLCE As SqlServerCe.SqlCeConnection ... Public Sub PrepareData ... Friend Versione As String ... Dim errorMessages As String ...
    (microsoft.public.dotnet.framework.compactframework)