Microsoft Access Can't Find the Field '|'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mcupito
    Contributor
    • Aug 2013
    • 294

    Microsoft Access Can't Find the Field '|'

    I get this error when I type in a whole number or .00.. but it still works. I just want the error to go away.

    Here is the code:

    Code:
    Private Sub ServiceHours_AfterUpdate()
    On Error GoTo Err_Handler
    
    
    Dim number, number2
    
        number = Int(Me.[ServiceHours])
        number2 = Me.[ServiceHours] - number
        
        
        Select Case number2
            Case 0
                Me.[ServiceHours] = [Me.ServiceHours]
            Case 0.0001 To 0.2499
                Me.[ServiceHours] = Me.[ServiceHours] - number2 + 0.25
            Case 0.2601 To 0.4999
                Me.[ServiceHours] = Me.[ServiceHours] - number2 + 0.5
            Case 0.51001 To 0.7499
               Me.[ServiceHours] = Me.[ServiceHours] - number2 + 0.75
            Case 0.76001 To 0.9999
                Me.[ServiceHours] = Me.[ServiceHours] - number2 + 1
                
        End Select
        
    Exit_Handler:
        Exit Sub
    Err_Handler:
        MsgBox Error$
        Resume Exit_Handler
    End Sub
    Last edited by Rabbit; Aug 20 '13, 08:29 PM. Reason: Please use code tags when posting code.
  • jimatqsi
    Moderator Top Contributor
    • Oct 2006
    • 1293

    #2
    Check all the properties of [ServiceHours] in the Data tab. Maybe it could be in another tab but I think most likely there you have a fatfinger entry | in one of the properties.

    Jim

    Comment

    • zmbd
      Recognized Expert Moderator Expert
      • Mar 2012
      • 5501

      #3
      line 28 MsgBox Error$
      this code is no longer the best practice.
      would you please change this to:
      MsgBox Err.Number & vbcrlf & Err.Description

      Re-run your code and then post back the EXACT error number and the EXACT text.
      I agree with jimatqsi; however, having the correct error message will help.

      Comment

      • mcupito
        Contributor
        • Aug 2013
        • 294

        #4
        Error number is 2645 .. I searched for a fatfinger entry "|" but was unable to locate one. Any other ideas?

        PS : I changed the error msg.

        Thanks.

        Comment

        • Rabbit
          Recognized Expert MVP
          • Jan 2007
          • 12517

          #5
          Line 13. It's supposed to be Me.[ServiceHours] not [Me.ServiceHours]

          Comment

          • mcupito
            Contributor
            • Aug 2013
            • 294

            #6
            Thanks, Rabbit. You hit the nail on the head.

            I am new to MS Access & took an intership where I am attempting to re-create the old database and strip unnecessary data, so I feel like I am in over my head at time.

            What resources are good to learn how to do what I need to do? I purchased 2003/2007 Step by Step Access books, and they are o.k. However, I want to understand how to use forms, subforms, reports and understand how the users will be entering/storing data. Any ideas?

            Thanks a bunch.

            Comment

            • Rabbit
              Recognized Expert MVP
              • Jan 2007
              • 12517

              #7
              Glad I could help.

              As far as learning Access, I learned through on the job training and trial and error.

              Comment

              Working...