Query: การใส่ Criteria ให้แสดงข้อมูลอื่นๆ ที่ไม่ได้ระบุ และข้อมูลที่ว่างเปล่าด้วย
กระทู้เก่าบอร์ด อ.สุภาพ ไชยา

 281   1
URL.หัวข้อ / URL
Query: การใส่ Criteria ให้แสดงข้อมูลอื่นๆ ที่ไม่ได้ระบุ และข้อมูลที่ว่างเปล่าด้วย

มีคนถามคำถามข้างต้นไว้ที่
http://www.helptalk.net/forums/access/messages/119718.html
...I'm trying to use;
Not like [Parameter] & "*" or is null.
Removing the "Not", and entering a value in the parameter I get the criteria record and the null values, as expected.
Entering no value in the parameter it will return all values, as expected.
But... when I use the "not" and enter nothing in the criteria it only returns null values instead of returning all values. Entering a parameter it works as expected.
How do I get it to return all values in a blank parameter?
Please help!!!!!
...

ผมได้ลองทำโดยการใส่ค่านี้ลงไปในช่อง Criteria ของ Field ที่ต้องการจะกำหนดเงื่อนไขการค้น คือ
Not Like IIf(IsNull([Parameter]),"",[Parameter] & "*") Or Is Null
ผลลัพธ์ที่ได้
1. ถ้า user ใส่ค่าใดๆ ในช่อง Parameter Input Box เช่น a หรือ ก ผลลัพธ์ที่ได้จะแสดงทุกรายการยกเว้นข้อมูลที่ขึ้นต้นด้วย a หรือ ก และข้อมูลที่ว่าง
2. ถ้าไม่ใส่ค่าใดๆ เลย ข้อมูลทุกรายการจะแสดงขึ้นมา

ผมได้ปรับโดยการใช้ IIf มาตรวจดูว่า user ใส่อะไรหรือเปล่า ถ้าไม่ จะให้ค่า
Not Like "" Or Is Null
ถ้าใส่ จะให้ค่า
Not Like [Parameter] & "*" Or Is Null

1 Reply in this Topic. Dispaly 1 pages and you are on page number 1

1 @R06491
   
@ ประกาศใช้งานเว็บบอร์ดใหม่ => บอร์ดเรียนรู้ Access สำหรับคนไทย
แล้วจะใส่ลิ้งอ้างอิงมาที่โพสต์เก่านี้หรือไม่ก็ตามสะดวกครับ
Time: 0.0919s