I am just become comfortable programming with VBA in Access 2013 (I'm used to using MYSQL and VB6 when I used to write programs for work 20 years ago!). So I am am an experienced programmer but by no means am I an expert at it, and I have run into a problem I can't seem to find a solution for, so I understand Office 2013 is about to be no longer supported, but since this program is going on a computer that is isolated from any exterior threat (i.e. not connected to the Internet) and I don't wish to spend more money on software that does the job. VBA for Access 2013 is designed to do what I am asking it to do, I just can't figure out why it's not working. It's a simple SQL SELECT Statement with a few conditions, that when I look at the Table, the record matches, but when I run it, there are no records being found. Here are the specifics:
I have a table "Inventory_New" that has a field "Sold_Location" that is blank until the item is Sold at a show or online and the field is updated to "Online" or "Show". Since there can be multiple quantities of the same Item SKU (Field "Item_SKU") I have the Select statement setup as follows:
TableFindItem = "Inventory_New"
rcdFindItemSKU = The SKU it is searching for
"SELECT * FROM " + TableFindItem + " WHERE Item_SKU = '" + rcdFindItemSKU + "' AND LEFT(Sold_Location, 1) <> 'S'" ' AND LEFT(Sold_Location, 1) <> 'O' ORDER BY Vendor_Purchase_Date ASC"
So it is selecting from the table, where the SKU matches the search SKU AND it is searching for all records that do not have an "S" or "O" as the first character in Sold Location. When I did a simple where Sold_Location = '', sometimes I would get an error that the field was null and would crash the program. Is there any other code that can be used to select the records that match the searchSKU and has no entry in the Sold_Location field?
I have spent hours on trying to figure out why this is happening, and have yet to find an answer.
Thanks for any help that can be provided!
Ken L