hi, i was wondering about using user-defined functions in an update query. specifically: i have a table that has a field that needs to have the 3rd character as a hyphen. most records already have that hyphen, but i need to fix the others.
anywho, i have two functions: one that checks to see if a hyphen is included and returns a boolean. the other function adds a hyphen.
i have an update query like this:
but i keep getting "The search key was not found in any record"
if i run this as a select query, it returns the results exactly as i want.
any thoughts?
oh, i was also wondering if, since the ProvID field is text, i would need some sort of quoting around the InsertHyphen function.
Thanks
ps i know that this isn't a good problem to have, and i am well aware of the design issues that have led to this in the first place. it will be corrected as time permits, but if we can piece together a quickie patch, it will help quite a bit.
anywho, i have two functions: one that checks to see if a hyphen is included and returns a boolean. the other function adds a hyphen.
i have an update query like this:
Code:
UPDATE tblDemographics SET tblDemographics.ProvID = InsertHyphen([tblDemographics.ProvID])
WHERE (ThirdChar([tblDemographics.ProvID])) = True;
if i run this as a select query, it returns the results exactly as i want.
any thoughts?
oh, i was also wondering if, since the ProvID field is text, i would need some sort of quoting around the InsertHyphen function.
Thanks
ps i know that this isn't a good problem to have, and i am well aware of the design issues that have led to this in the first place. it will be corrected as time permits, but if we can piece together a quickie patch, it will help quite a bit.