Hi Everyone,
As strange as it is, this code passes syntax and works!
I had this exact statement before, but it didn't seem to want to play.
'completed' is not needed for display, but is needed for distinction, so completed = 0 remains and the value = 0 is forced when the entry into the table occurs (It's a checkbox on the form), without forcing 0 in this case, it leaves the DB_INTEGER as Null, UNKNOWN, or some other value I can't determine or match, so I forced 0.
Notice the ORDER BY is hardcoded as well as completed = 0.
DBUtils.ExecuteTableView(RMSQL, "SELECT [load_ref], [loadid], [pu_date], [del_date]," _
&"[paid_miles],[money_offered],[pckid],[delid] FROM loadlist WHERE completed = 0 ORDER BY load_ref DESC", _
Null, 0, loads_tv)
The following passes syntax and does not throw an error, but returns an empty table
, bummer!
DBUtils.ExecuteTableView(RMSQL, "SELECT [load_ref], [loadid], [pu_date], [del_date]," _
&"[paid_miles],[money_offered],[pckid],[delid] FROM loadlist WHERE ? = ? ORDER BY ? DESC", _
Array As String("completed",0,"load_ref"), 0, loads_tv)
I modified the 0 as an int, placed in quotes - bracketed [load_ref] or unbracketed with the same results.
I tried using the Array As String to substitute just for 'completed' and so forth to no avail. The substitution isn't playing!
I looked at all my other uses of DBUtils.ExecuteTableView and none of them use substitution through the Array As String (), and work flawlessly!
I think DBUtils is awesome!, I just needed to know how to get around this oddity where the substitution doesn't seem to work.
I'm also completely open to the idea that I'm not coding or using it correctly!
So, my conclusion at this point is -
Hard code the sql statement for WHERE, ORDER BY and sort order, and it works!
Changing the Title back to [Solved]