Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    wmpwi is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    13

    Help w/ an error after upgrading Access 2003 > 2010


    We've used a simple 2003 Access DB under XP for years and just upgraded to Win 7 w/ Access 2010. Everything works fine except for one routine. It's part of an office sign in / out form that edits a table of staff members to track who's here and who's not. Since the upgrade, we get an error and can't sign in. We can edit the table fine (a signing out form) but the when we attempt to sing in, the following error pops:

    Error, you did not sign in. Microsoft Access can't move the focus to the control InOut. You entered a number that does not exist

    I know some remedial Access programming and even less of Visual Basic, but I'm trying and I follow directions pretty well. Near as I can tell, 2010 doesn't like something that 2003 could live with.

    The is the script that I believe is running.

    Thanks for any guidance.

    Option Compare Database
    Option Explicit
    Dim StaffNumber As String


    Private Sub Form_Load()
    'TimerInterval = 3000
    End Sub

    Private Sub Form_Open(Cancel As Integer)

    On Error GoTo SignIn_Form_Open_Err
    Dim Message, Title As String
    Message = "Enter your caseload number."
    Title = "SignIn Screen."

    StaffNumber = InputBox(Message, Title)

    Me.Filter = "[StaffNum] = '" & StaffNumber & "'"
    Me.FilterOn = True
    InOut.SetFocus
    InOut.Text = "In"
    DutyStaff.SetFocus
    DutyStaff.Text = ""
    TimeBackIn.SetFocus
    TimeBackIn.Text = ""
    ExtendedAbsence.SetFocus
    ExtendedAbsence.Value = False
    ExtRetDate.SetFocus
    ExtRetDate.Text = ""
    Notes.SetFocus
    Notes.Text = ""
    TimeBackIn.SetFocus
    DoCmd.Close
    Exit_Form_Open:
    Exit Sub
    SignIn_Form_Open_Err:
    MsgBox "Error, you did not sign in. " & Err.Description & " You entered a number that does not exist"
    Me.Undo
    DoCmd.Close acForm, "SignInForm", acSaveNo

    Exit Sub


    End Sub

    Private Sub Form_Timer()
    'Me.Undo
    'DoCmd.Close acForm, "SignInForm", acSaveNo
    End Sub

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Remove the error trap by commenting out "On error", then debug to see which line is causing the issue.

    'On Error GoTo SignIn_Form_Open_Err
    Dim Message, Title As String
    Message = "Enter your caseload number."
    Title = "SignIn Screen."

  3. #3
    wmpwi is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    13
    Thanks.
    I get

    Run-timer error '2110':

    Microsoft Access can't move the focus to the control InOut.

    InOut.SetFocus
    is highlighted.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Check the name of your control. Use the Other tab in the property sheet to determine the name. The name of the Control needs to match your VBA. If you can not set focus on that control you may have additional trouble executing the rest of your code.

  5. #5
    Xipooo's Avatar
    Xipooo is offline Sr. Database Developer
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Location
    Arizona
    Posts
    332
    You might want to start your call to the control with the me keyword to make sure you're using the correct control name.

  6. #6
    wmpwi is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    13
    I select the field StaffNum (which by the way is a 4 digit id) in the form and check in the other property tab, it shows the property Name as StaffNum so I think that part seems to match the VB code.

    At the risk of complicating things (BTW, I didn't do the coding) I noticed that there are "Event Procedures' in the Form | Event tab in 3 separate properties; all referencing the same code. They are On Load, On Open, and On Timer. Would that make any difference? and if not, well, that was my shot.

    Thanks for your continued assistance.

  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by wmpwi View Post
    ... all referencing the same code. They are On Load, On Open, and On Timer. Would that make any difference? and if not, well, that was my shot....
    Have the same code fire in different events is not uncommon.

    If you are getting an error at the following line

    InOut.SetFocus

    This suggests there is a problem where Access does not understand what InOut is and or the control named "InOut" is not available for the method or property you are trying to use. I would double check the name for this control

  8. #8
    wmpwi is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    13
    Quote Originally Posted by Xipooo View Post
    You might want to start your call to the control with the me keyword to make sure you're using the correct control name.
    I was looking for an emoticon that conveys something shooting over my head, but this is as close as I can get.

    Yeah, I'm a bit out of my depth here on VB.

  9. #9
    wmpwi is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    13
    Just to make sure I not missing something you need, InOut is a table where the comings and goings of staff are tracked.

    The form that's broken is named SignInForm. It appears to be a copy of the SignOutForm (which works fine) except the only visible part of the SignInForm is a script window that asks Enter your caseload number and essentially zeros out the fields indicating date and time expected back.

    So I guess what I'm saying is that a copy of the same form works fine when signing out (user entered data fields) doesn't work when having it automatically or editing those same fields using the VB script above. The only other difference between the two forms is the error trapping that forces which fields need to be entered.

  10. #10
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    The following suggests you are trying to assign a value to a control named "InOut".

    InOut.SetFocus
    InOut.Text = "In"

  11. #11
    wmpwi is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    13
    Yes (I think). The sequence is: user selects "sign in" from a menu and it opens the signInForm (hidden) with a dialog box visible requesting Enter a caseload number (4 digit StaffNum) then the VB script is supposed to edit all the fields to "empty" them so that people on the InOut table look like they're in rather than out with the date and times they are expected to return.

    In my own clumsy way of understanding what the VB script is doing is

    Prompts for StaffNum
    Filters for the StaffNum

    Selects the table InOut
    Selects the field InOut
    Enters text "In" in field InOut
    Selects the field DutyAgent
    Enters text "" in the field DutyAgent
    Selects the field TimeBackIn
    Enters text "" in the field TimeBackIn

    and so on.

  12. #12
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Just to make sure I not missing something you need, InOut is a table where the comings and goings of staff are tracked.
    Is there also a field named "InOut"? Access might be getting confused on this form...


    Selects the table InOut
    Selects the field InOut
    You cannot "select a table" while in a form unless you are editing/changing the form record source.
    "InOut.Setfocus" is setting the focus to the control named "InOut".

    I would suggest deleting the control bound to the field named "InOut", then adding it to the form again.

    Next, I would do as Xipooo suggested, add the "Me." keyword to the code:

    "Me.InOut.SetFocus"

  13. #13
    wmpwi is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    13
    Thanks. That actually makes some sense to me. I kind of discounted that possibility since it still works fine on XP. I'll give it a whack tomorrow and let you know. Thanks.


    Quote Originally Posted by ssanfu View Post
    Is there also a field named "InOut"? Access might be getting confused on this form...



    You cannot "select a table" while in a form unless you are editing/changing the form record source.
    "InOut.Setfocus" is setting the focus to the control named "InOut".

    I would suggest deleting the control bound to the field named "InOut", then adding it to the form again.

    Next, I would do as Xipooo suggested, add the "Me." keyword to the code:

    "Me.InOut.SetFocus"

  14. #14
    Xipooo's Avatar
    Xipooo is offline Sr. Database Developer
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Location
    Arizona
    Posts
    332
    One other thing that comes to mind, do NOT name your controls the same as a field from the data source of the form. I have had plenty of instances where an older version of Access allowed for the name of a textbox to be the same as a data field of the query behind the form and it worked, but after migrating to a newer version of Access the code fell apart. Make sure you prefix your form controls with some sort of indication what the control is.. IE: txtInOut

    This way there is no potential for confusion if there is a field called InOut on your table.

  15. #15
    wmpwi is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    13
    The code for this application was written over 10 years ago by someone long since retired. The suggestions offered by Xipooo, ItsMe, and ssanfu are very helpful and I'm trying, but to the novice, looking at someone else's work seem like trying to untangle some seriously messed up fishing line. In the mean time, I've come up w/ a workaround by taking an existing working form (the sign-out form) and peeling away everything I can until I arrive at something close to the sign-in form (that doesn't work). Comparing the two is also helping me understand some of what's going, but it's a process. Thanks for the help and I'll keep gnawing at it.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 02-11-2014, 09:41 AM
  2. Replies: 15
    Last Post: 07-17-2013, 11:29 AM
  3. Type mismatch Error after upgrading to Access 2010
    By twm07073 in forum Programming
    Replies: 7
    Last Post: 06-13-2012, 10:07 AM
  4. 2113 Error happening from Access 2003 to 2010
    By johnnyflames in forum Forms
    Replies: 5
    Last Post: 06-08-2012, 01:42 PM
  5. Error after upgrading to Access 2007
    By bmcclellan in forum Queries
    Replies: 9
    Last Post: 03-22-2010, 10:19 AM

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