Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2015

    Unanswered: expected end of statment?

    No matter which way I try to write this IIf statement it gives me expected end of statement right at my "0"

    Forms![table1_f]![table1 subform].Form.AllowAdditions = True
    DoCmd.GoToRecord , , acNewRec
    Forms![table1_f]![table1 subform].Form.pass = IIf(DMax("[pass]", "Query1")) = "0","1", DMax("[pass]", "Query1") + 1
    Forms![table1_f]![table1 subform].Form.AllowAdditions = False

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    That error message usually indicates a bracketing error. Either one where it doesnt expect one or t'other way round. In this case id suspect the second closing bracket BEFORE = "0" is the culprit.

    On top of that Id be surprised if the 0 should be delimited as you are trying to add one to the similar expression later. You don't delimit numeric values, you do text, or alphanumerics and you do date literals.

    I have reservations about what you are trying to achieve with this code. The result of a dmax where it can find no match is NULL. NOT 0
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Dec 2013
    Provided Answers: 1

    Try this instead:

    Forms![table1_f]![table1 subform].Form.pass = Nz(DMax("[pass]", "Query1"), 0) + 1


  4. #4
    Join Date
    Jul 2015
    healdem thanks, I see now. Yes that should be a null not zero, I'm still learning and when i look at this for too long it starts to meld together.

    Wayne, That seems to work perfectly for me, it increment the max pass number by one, and if its new pass starts at one.... thanks a bunch! Ill have to look into the NZ and learn more about that function.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts