I currently have a system of importing an Excel into a table, which includes the Zip Code. The Zip Code has instances of 10 Characters (#####-####) - and sometimes just the first 5 Characters (#####).
I am looking for a way for it to detect the one's that have the 10 Characters with 4 Digit extension and place those 4 Characters in a different field. Below is What I have for my code. However, it is giving me a Data Type Mismatch.
Can anyone possibly help me to detect what is wrong? Both the Zip Code and the Zip Extension are Text Fields with default settings. BATCH_NO is simply the current import, and this condition works on all other parts of the import. So Unless I made a syntax error on BATCH_NO that isn't a problem.
Error I am currently getting: "Data Type Mismatch in criteria expression."
Dim tempsql As String
tempsql = "UPDATE Processing" & _
" SET [Zip Extension] = RIGHT([Zip Code],4)" & _
" WHERE (LEN([Zip Code]) > 5) AND (BATCH_NO = " & li_batch_no & ")"
CurrentDb.Execute tempsql
BATCH_NO
? – Mike