sql - Why doesn't my query use my criteria? -


I have a DB in access and I'm trying to get a text box to run my query and one As the criterion for the value of the other bound text box in DLookUp . I have a running query in the design scene and when I enter the criteria directly it gives the right result when I open the report, then gives me the sum of all the possible rows. In other words, it does not filter rows

I have not used access in almost twelve years, thank you , and till that point I have done that tutorial / Example patchwork, but here it is.

SQL query:

  SELECT Sum (IIf (present = -1,1,0)) with presence of Students_Classes_Attendance WHERE (((CST ([Student's link / help ] [Class_Id])) = [CLASSID])); DLookUp as a control source:  
  = DLookUp ("[total attendance by class]! [Presence]", "[total attendance by class]", "[square_ID] =" & amp; ; [Class_ID])   

I am lost at this time I'm guessing that the query is not worth before the fire and since the criteria is an optional parameter that is passing it nonsensical , But I hope you will get an error from that it is not that # error by the way Minister is very meaningful.

Is there a problem and some know the best way to fix it? Thank you.

Edit:
I made the recommended changes in reply, so now my DLookUp looks like this ...

  = DLookUp ("[presence]", "[total attendance by class]", "[class_ID] =" & [class_id])   

. Still, for all rows, it does not make any difference with the removal of the criteria, which gives me back to think that it has nothing to do with the forced text box which is not worth it.

  1. Syntax for numerical values:
    DLookup ("FieldName", "TableName") "Text">

    DLookup uses the following syntax:

    1. , "benchmark = n")
    2. Syntax for strings: (Note the single apostry before and after the string value)
      DLookup ("FieldName", "TableName", "Criteria Syntax for date: (Note # Before and after DLookup ("FieldName", "TableName", " Criteria = #date # ")

      I believe First you need to remove the name of the table from the parameter:

        = "DLookUp" ("[presence]", "[total attendance by class]", "[square_id] = Keep in mind that if class_id is a text field, you must fill it with a quotation mark:  
        = DLookUp ("[presence]", "[total attendance by class]", "[square_ID] = '' & amp; [Class_id] and "'")    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -