I have an AcctNo field called AcctToUse (it's actually datatype Text, 50 chars long). I created this field in (table) Design view. It's default value is empty string.
In VBA I set this value to -1 all the way down the column.
DoCmd.RunSQL "UPDATE Posted SET AcctToUse = '-1' "
Later on an INNER JOIN is returning zero records because of failing WHERE clause
WHERE Posted.AcctToUse = '-1'
This shouldn't fail because, looking at the table, all the values are indeed -1. But then I looked a little closer. The value -1 is space-padded to a length of 50 so that it's real value is something like this (I'll use an underline here as a fake space)
'-1____________________________________'
And I verified this by doing a query:
SELECT AcctToUse, Len(AcctToUse) FROM Posted
This returns a length of 50 all the way down.
Why the padding?
In VBA I set this value to -1 all the way down the column.
DoCmd.RunSQL "UPDATE Posted SET AcctToUse = '-1' "
Later on an INNER JOIN is returning zero records because of failing WHERE clause
WHERE Posted.AcctToUse = '-1'
This shouldn't fail because, looking at the table, all the values are indeed -1. But then I looked a little closer. The value -1 is space-padded to a length of 50 so that it's real value is something like this (I'll use an underline here as a fake space)
'-1____________________________________'
And I verified this by doing a query:
SELECT AcctToUse, Len(AcctToUse) FROM Posted
This returns a length of 50 all the way down.
Why the padding?