Results 1 to 5 of 5
  1. #1
    phi.21st is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    5

    Me.AccessField

    Hello,

    I have a code like this (MS Access 2010):

    Me.Name

    Where "Name" is an Access Field.



    This code works in my PC but not in other PC.
    Can anyone tell me why this code sometimes works but sometimes doesn't?

    Thanks,
    phi.21st
    Last edited by phi.21st; 08-21-2011 at 11:54 PM. Reason: Just want to add "Thanks" in the bottom of my post

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,601
    Why doesn't it work - error message, wrong results, nothing happens?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    phi.21st is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    5
    It gives Compile Error: Method or Data member not found.

    Strange.. I changed the code to: Me!Name and it works !!

    I found this on Google:
    http://www.pcreview.co.uk/forums/com...-t1156996.html,
    and i think the problem is related to Service Pack.

    I hope this problem wont occur anymore by coding it with Me!Name

    Anyway thanks,
    phi.21st

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,601
    I suspected this might be the issue. I always make sure controls have a meaningful name that is different from the bound field, like txtCustomerID. In VBA code I use the bang to qualify field name, dot for controls. The bang also applies when referring to fields of a VBA coded recordset.

    Is 'Name' actually the name of a field or is this just a generic alias you used for the post? Should not use reserved words as names, if you do must in enclose in []. Same goes for names with spaces, special characters, punctuation (underscore is an exception).
    Last edited by June7; 08-22-2011 at 02:06 PM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Me.Name SHOULD return the name of the form, not a field or control. But that is one of the reasons why you should NOT use NAME as the name of a field or object. NAME is an Access Reserved Word and one of the worst to use as everything (or almost everything) in Access has a .Name property.

Please reply to this thread with any new information or opinions.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums