jakeisstoked
Technical User
Hi, I have this query being executed in VBA, it's a long insert query and it's getting the data from a form, problem is not all of the fields are required, and I will get a "data type mismatch in expression" exception if there are any null values.
With a query that isn't running from code this isn't a prob because Access just pops up an error message asking if you wan't the fields to have null values, but the exact same query from VB has the error, and wont continue (obviously I can ignore the exception, but then there's no insert).
eg
"INSERT INTO table (field1, field2, field2, etc...) VALUES
('" & variable1 & "', '" & variable2 & "', '" & variable3 & "', '" & etc... & "');"
so if any one of the variables is blank then it screws up. But I NEED to allow for different combos of blanks and I NEED this query running from code. I've tried many combinations of variables and quotes, but I'm stuck.
Is this possible?
-Jake
With a query that isn't running from code this isn't a prob because Access just pops up an error message asking if you wan't the fields to have null values, but the exact same query from VB has the error, and wont continue (obviously I can ignore the exception, but then there's no insert).
eg
"INSERT INTO table (field1, field2, field2, etc...) VALUES
('" & variable1 & "', '" & variable2 & "', '" & variable3 & "', '" & etc... & "');"
so if any one of the variables is blank then it screws up. But I NEED to allow for different combos of blanks and I NEED this query running from code. I've tried many combinations of variables and quotes, but I'm stuck.
Is this possible?
-Jake