Results 1 to 4 of 4
  1. #1
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544

    Dmax - type mismatch error

    Hello all!



    Pulling my hair out, I need to create a sequential number to order payments the way they are entered, long story. My table is ScheduleT (part of an amortization app) both LoanID and PaymentNumber are numeric fields, my code:
    Code:
    Me.Sequence = Nz(DMax("[Sequence]", "schedulet", "LoanID=" & Forms!LoanF!LoanID), 0) And ("paymentnumber = " & Forms![LoanF]![ScheduleF].Form![PaymentNumber]) + 1
    If I remove the second criteria it works fine, except it numbers all of the remaining payments, which I don't want. Does anyone see a glaring error with my quotes or something? I'm getting "type mismatch" with the whole line highlighted.

    Thanks in advance!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    The second criteria isn't in the DMax. More like:

    Nz(DMax("[Sequence]", "schedulet", "LoanID=" & Forms!LoanF!LoanID & " And paymentnumber = " & Forms![LoanF]![ScheduleF].Form![PaymentNumber]), 0)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544

    Smile

    Quote Originally Posted by pbaldy View Post
    The second criteria isn't in the DMax. More like:

    Nz(DMax("[Sequence]", "schedulet", "LoanID=" & Forms!LoanF!LoanID & " And paymentnumber = " & Forms![LoanF]![ScheduleF].Form![PaymentNumber]), 0)
    THANK YOU PBaldy - worked like a charm!

  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,642
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Type 13 (Type Mismatch) error
    By sdel_nevo in forum Programming
    Replies: 5
    Last Post: 01-22-2016, 10:01 AM
  2. Error 13 Type Mismatch
    By jj1 in forum Access
    Replies: 5
    Last Post: 05-21-2014, 12:33 PM
  3. Replies: 7
    Last Post: 07-24-2013, 02:01 PM
  4. Replies: 1
    Last Post: 05-11-2012, 10:59 AM
  5. type mismatch error?
    By hlcarlin in forum Programming
    Replies: 1
    Last Post: 07-07-2011, 08:30 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