Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Morecambe England, Lancashire, England
    Posts
    105
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Form Names with Spaces (Access 200)

    In the bad old days before I learnt better, I would use a form name like Active Records. Now I know its better to use something like FrmActiveRecords

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

    Re: Form Names with Spaces (Access 200)

    Michael,

    You can put square brackets around names with spaces or unusual characters:

    <code>Forms![Active Records].Refresh</code>

    The same holds for control names and field names with spaces.

  3. #3
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Form Names with Spaces (Access 200)

    Note - another option is to reference form name as a text string; the syntax is same whether or not form name has spaces in it:

    ? Forms.Item("Form 1").Name
    Form 1

    Since the Item property is the default member of the Forms collection, the above syntax can be shortened to:

    ? Forms("Form 1").Name
    Form 1

    This syntax is useful if you need to use a String variable to refer to a form or forms.

    HTH

  4. #4
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Morecambe England, Lancashire, England
    Posts
    105
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form Names with Spaces (Access 200)

    Gentlemen - Thank you both for your helpful replies

    Michael Peak
    Morecambe Emgland

  5. #5
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Morecambe England, Lancashire, England
    Posts
    105
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form Names with Spaces (Access 200)

    Hans,

    After thanking you for your help - yet again, I realise just how blindingly obvious your answer was. Of course you can put square bracket round a name. I do that all the time in reports:- for example = ("Client is "& [Tiltle] & " ,"&[FirstName]&" ,"&[Lastname]) if you wanted to add several fields together on a report.

    I don't suppose you remember, but it was rather like one question I asked you about ordering fields on a form in the table view; it's exactly the same as moving fields around in a query.

    I shall try and think laterally next time before bothering you!

    Best Wishes

    Michael

  6. #6
    Star Lounger
    Join Date
    Jan 2003
    Location
    Manchester, Lancashire, England
    Posts
    92
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form Names with Spaces (Access 200)

    (Edited by HansV to make URL clickable - see <!help=19>Help 19<!/help>)

    Another thought re the original question is to use Find & Replace from http://www.RickWorld.com to remove the spaces. In my youthful innocence I too wrote a db without using a naming convention & Find & Replace saved a huge amount of manual work sorting it out when realisation dawned!

Posting Permissions

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