Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Brugge, Belgium
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    A form as parameter (ms Access 2007)

    In a module i like to place a public function that expect a form as parameter. e.g. Public function Capitalletters( frm As form), So that in this function i can
    for example use the statement : frm.recordsource = ...
    Suppose now that I want to call this function from a form with the name "frmKlanten"
    Is it wright to use the following code for the event afterupdate of a control in this form : = Capitalletters("frmKlanten") or = Capitalletters(Form)

  2. #2
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: A form as parameter (ms Access 2007)

    =Capitalletters(Me.Name) would avoid typos in the name of the calling form.
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

  3. #3
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Brugge, Belgium
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: A form as parameter (ms Access 2007)

    Thank you very much for the advice

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: A form as parameter (ms Access 2007)

    The function takes a Form object as parameter, not a string, so Capitalletters("frmKlanten") or Capitalletters(Me.Name) won't work.
    If you want to use the function in the Event tab of the Properties window, use =Capitallletters([Form])
    If you want to use it in VBA, use =Capitalletters(Me)

Posting Permissions

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