Results 1 to 7 of 7
  1. #1
    energizer32 is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Dec 2016
    Posts
    3

    Run-Time Error 13 MisMatch


    I currently took over someones manpower Database, when user attempts to input hours and then get total of hours, I get a run-time Error 13 and the debug takes me to this string of codes. I'm new to Access and asking if I can get some assistance.

    Text40.SetFocus
    Text40.value = Text40.value + hours + overtime + regularComp + travelComp

  2. #2
    Gina Maylone is offline Always learning
    Windows 7 64bit Access 2013
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    Is it possible there are no values in any of those fields? I always use the NZ function when calculating just to be safe. IE.
    Code:
    nz(Text40.value,0) + nz(hours,0) + nz(overtime,0) + nz(regularComp,0) + nz(travelComp,0)
    HTH.

  3. #3
    energizer32 is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Dec 2016
    Posts
    3
    OK I inputed that code in and I think it starts further ahead. I input hours in the first time it accepts my input, but when I input the next set of hours I get this error.
    I still get that Code highlighted. I sent a screen shot to show that in the second input of hours is blank, but I did added the hours above. What other info do you need? Also when I try edit the line with missing hours I get a Run-Time Error 13 again. With this now highlighted
    Code:
     If hours > 0 Then       Me!Text68 = "Regular"
        ElseIf overtime > 0 Then
           Me!Text68 = "Overtime"
        ElseIf regularComp > 0 Then
           Me!Text68 = "Regular Comp"
        ElseIf travelComp > 0 Then
           Me!Text68 = "Travel Comp"
        End If
    Click image for larger version. 

Name:	2016-12-13 (2).png 
Views:	10 
Size:	31.1 KB 
ID:	26720

  4. #4
    Gina Maylone is offline Always learning
    Windows 7 64bit Access 2013
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    Which field is text40? What format is it? (text, number, etc)? I have a feeling that's where the problem is.
    Text40.SetFocus
    Text40.value = Text40.value

  5. #5
    energizer32 is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Dec 2016
    Posts
    3
    Format is Blank

    Code:
    Private Sub Text40_BeforeUpdate(Cancel As Integer)
    
    End Sub
    Click image for larger version. 

Name:	Capture.PNG 
Views:	6 
Size:	25.0 KB 
ID:	26724
    Attached Thumbnails Attached Thumbnails Capture.PNG  

  6. #6
    Gina Maylone is offline Always learning
    Windows 7 64bit Access 2013
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    Quote Originally Posted by energizer32 View Post
    OK I inputed that code in and I think it starts further ahead. I input hours in the first time it accepts my input, but when I input the next set of hours I get this error.
    I still get that Code highlighted. I sent a screen shot to show that in the second input of hours is blank, but I did added the hours above. What other info do you need? Also when I try edit the line with missing hours I get a Run-Time Error 13 again. With this now highlighted
    Code:
     If hours > 0 Then       Me!Text68 = "Regular"
        ElseIf overtime > 0 Then
           Me!Text68 = "Overtime"
        ElseIf regularComp > 0 Then
           Me!Text68 = "Regular Comp"
        ElseIf travelComp > 0 Then
           Me!Text68 = "Travel Comp"
        End If
    Click image for larger version. 

Name:	2016-12-13 (2).png 
Views:	10 
Size:	31.1 KB 
ID:	26720
    When you get the error and the code is highlighted, press F8 to step through the code, which line does it stop working?

  7. #7
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Make sure that all form fields that are being used in calculations have a number format, starting with Text40.

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

Similar Threads

  1. Run-time error 13 type Mismatch
    By Jaron in forum Programming
    Replies: 2
    Last Post: 09-13-2013, 02:33 PM
  2. Run-time error 13: type mismatch
    By ehe in forum Programming
    Replies: 3
    Last Post: 01-13-2013, 12:58 AM
  3. run-time error '13' type mismatch
    By teebumble in forum Forms
    Replies: 8
    Last Post: 12-03-2012, 01:18 PM
  4. run-time error 13 , type mismatch
    By Compufreak in forum Programming
    Replies: 8
    Last Post: 08-13-2012, 12:17 AM
  5. Run-time error '13': Type mismatch
    By uronmapu in forum Access
    Replies: 2
    Last Post: 07-10-2012, 07:59 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