Gasman
Enthusiastic Amateur
- Local time
- Today, 18:53
- Joined
- Sep 21, 2011
- Messages
- 17,533
You have been shown an easier method, where type mismatch is hard to accomplish?I am back to my original issues of data mismatch and I know it is because I have the strWhere statement incorrect but I don't know how to correct it. I am away until Monday and will be back at this again then. Have a great weekend everyone
@MajP has a function to build the SQL correctly.
FYI,
I use a CSQL function for all of my values. Saves a lot of time and gets it correct. If you are referencing a variant datattype (anything coming from a control) no need to specify the datatype. It will know if it is a string, numeric or date.
I use a CSQL function for all of my values. Saves a lot of time and gets it correct. If you are referencing a variant datattype (anything coming from a control) no need to specify the datatype. It will know if it is a string, numeric or date.
Code:
Public Enum SQL_DataType
sdt_boundfield = -1
sdt_UseSubType = 0
sdt_text = 1
sdt_Numeric = 2
sdt_date = 3
sdt_Boolean = 4
sdt_Null = 5
End Enum
'**************************************************************************************************************
'----------------------------------------Convert To Delimited SQL...
If you still insist on trying to build it yourself?
Strings need to be surrounded by single quotes ' unless it contains a single quote, then triple double quotes works, I think?
Date literals with # and in mm/dd/yyyy or yyyy-mm-dd format
Numbers do not need anything
Also for anything other than one item of criteria, I tend to put the the criteria into a string variable and then debug.print it, until correct then also use that in the code.
Added benefit is, if you still cannot see the error, you can copy and paste back here the output from the debug.print for someone else to spot it.