Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Nov 2001
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts

    FormName as parameter (Access 2000)

    I want to build a function that can be used with 4 forms, and i wanrt to enter the form name as a parameter

    However the function i have built is not working.I must have a grave mistake somewhere.
    My failed function is:


    Public Function FncAfid(strFormName As String)
    DoCmd.OpenForm strFormName, acDesign
    Forms!strFormName!office.DefaultValue = 1
    DoCmd.Close acForm, strFormName, acSaveYes
    DoCmd.OpenForm strFormName
    End Function

    And then on the OnClick event i enter Call FncAfid(frmOrders)

    But i have not succeeded.
    may i ask for help?

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FormName as parameter (Access 2000)

    Change te line
    Forms!strFormName!office.DefaultValue = 1
    to
    Forms(strFormName)!office.DefaultValue = 1
    Francois

  3. #3
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FormName as parameter (Access 2000)

    In addition :
    if the name of the called form frmorders is and not a variable, use :
    Call FncAfid("frmOrders")
    Francois

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •