Results 1 to 5 of 5
  1. #1
    Dazza666 is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2013
    Posts
    8

    Question constantly needs focus

    Hi,



    I can't see why almost everytime I reference a property of an object through through an event (for example "on click") I get an error requiring me to set the focus to the object first, normally I can do this by adding object.SetFocus first however i'm now trying to append the text from a textbox as below, to a string and it just errors out because of the last element me.notes.text stating the object needs focus.

    I've worked mildly with access in the past and I don't remember needing to give an object focus for almost every single action! I'm running access 2013, any help would be appreciated

    Code:
    MyItem.Body = "Request Title" & vbCrLf & vbCrLf & DLookup("RequestTitle", "MaintenanceRequest", "ID=" & Me.RequestID) & vbCrLf & vbCrLf & "Request Description" & vbCrLf & vbCrLf & DLookup("RequestDescription", "MaintenanceRequest", "ID=" & Me.RequestID) & vbCrLf & vbCrLf & "Escalation Notes:" & vbCrLf & vbCrLf & Me.Notes.Text

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    In Access, a control usually needs the focus in order to use the .Text property which is why we use the .Value property instead which does not need the focus.

  3. #3
    Dazza666 is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2013
    Posts
    8
    Quote Originally Posted by RuralGuy View Post
    In Access, a control usually needs the focus in order to use the .Text property which is why we use the .Value property instead which does not need the focus.
    That's it, that's sorted it out, thanks for the help and taking the time to explain, really appreciate it.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    RG has already resolved your issue, but if you're bored and want more info:

    http://www.baldyweb.com/ValueText.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Excellent! Glad we could help.

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

Similar Threads

  1. Subforms constantly refresh
    By DarkWolff in forum Forms
    Replies: 3
    Last Post: 02-28-2012, 02:53 PM
  2. Set Focus on Subform
    By GCS in forum Forms
    Replies: 1
    Last Post: 12-01-2011, 11:46 AM
  3. Focus on Key Control
    By windwardmi in forum Access
    Replies: 1
    Last Post: 09-07-2011, 04:57 PM
  4. Will not set focus
    By AKQTS in forum Programming
    Replies: 4
    Last Post: 05-04-2011, 06:38 AM
  5. Text Get Focus
    By blueraincoat in forum Forms
    Replies: 4
    Last Post: 03-14-2011, 06:10 PM

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