Following is my code i have used two combo boxes for the search in the form. The code works fine in the VBA but the problem arises as follows
Code:
SELECT tbl_item.itemID_PK, tbl_item.item, tbl_category.category, tbl_itemtype.type, tbl_perbelongsto.pname, tbl_rooms.roomname
FROM tbl_rooms INNER JOIN (tbl_perbelongsto INNER JOIN (tbl_itemtype INNER JOIN (tbl_category INNER JOIN tbl_item ON tbl_category.[categoryID_PK] = tbl_item.[categoryID_FK]) ON tbl_itemtype.[itemtypeID_PK] = tbl_item.[itemtypeID_FK]) ON tbl_perbelongsto.[itembelongtoID_PK] = tbl_item.[itembelongtoID_FK]) ON tbl_rooms.room_PK = tbl_item.[roomID_FK]
WHERE (((tbl_itemtype.type)=[Forms]![frm_item_entry]![]) AND ((tbl_perbelongsto.pname)=[Forms]![frm_item_entry]![cbobelongto]));
in the combo boxes of the frm_item_entry it linked primary ID with 0cm width and shows items name only bound to column one
the items are
PK item
1 A
2 b
3 c
4 all item
so i want to select "all item" in the combo box it does not work. I dim selectpk as integer and make the if statement if selectPK=4 then the string should display all the record as mentioned in combo box one and anly those record equal to feild in the second combo box.