Hi all,
I'm trying to run a simple check for an existing record to update, but for some reason my Select statement doesn't find the record with the matching text field in my Access table, even though it exists. If I switch over and use an integer field with the same select statement it finds the matching record no problem.
Is there some x factor to matching text fields that I am missing. I'm new to this so bear with me if I'm missing something obvious. Here's the code:
The string variable sJobNum absolutely perfectly matches the OJobNumber (text, 9) field in the Access DB. It won't find a match even if I hard code the string in place of that variable.
However, if I switch the statement to evaluate against a different field, which is an Integer field and feed it a matching integer variable, it finds the match with no problem.
Any advice appreciated!
Thanks,
AJ
I'm trying to run a simple check for an existing record to update, but for some reason my Select statement doesn't find the record with the matching text field in my Access table, even though it exists. If I switch over and use an integer field with the same select statement it finds the matching record no problem.
Is there some x factor to matching text fields that I am missing. I'm new to this so bear with me if I'm missing something obvious. Here's the code:
Code:
sSql = "SELECT * From DictationLog WHERE DictationLog.[OJobNumber]=" & sJobNum
Set rCurrRec = dLog.OpenRecordset(sSql)
The string variable sJobNum absolutely perfectly matches the OJobNumber (text, 9) field in the Access DB. It won't find a match even if I hard code the string in place of that variable.
However, if I switch the statement to evaluate against a different field, which is an Integer field and feed it a matching integer variable, it finds the match with no problem.
Any advice appreciated!
Thanks,
AJ