I am getting a "type mismatch in expression" in Access. I've gone back to the original tables where the data was pulled from and both tables have the data type as Short Text. The data is an Invoice number. After running some queries and code the final table created has the data type as Number - Long Integer.
In the code the lines for Invoice# are as follows:
' Create summary records from detail records
Dim dt_invoice As Variant
Addrec:
rstOutput![Invoice#] = dt\_invoice
' Store off this record's values
dt_invoice = rstRenewals![Invoice#]
I found this explanation on learn.microsoft.com:
Generally, numeric Variant data is maintained in its original data type within the Variant. For example, if you assign an Integer to a Variant, subsequent operations treat the Variant as an Integer. However, if an arithmetic operation is performed on a Variant containing a Byte, an Integer, a Long, or a Single, and the result exceeds the normal range for the original data type, the result is promoted within the Variant to the next larger data type. A Byte is promoted to an Integer, an Integer is promoted to a Long, and a Long and a Single are promoted to a Double.
So I would think that the data type should be the same as what it was in the tables that it came from. How would it get to be a Number - Long Integer? How can I force it to be Short Text?
Thanks,
Jessica