This topic is locked

Undefined Function 'Nz'

3/6/2009 4:54:21 AM
ASPRunnerPro General questions
J
James_Parker author

Hello,
I am trying to replace records in a table with records from another table if they're different. The following code gives me an error reading 'undefined function 'nz' in expression. I'm not even using 'nz'
StrSQL = "UPDATE dbo_jobs SET JobName = (SELECT [Edited Jobs].TITLE FROM [Edited Jobs] WHERE [Edited Jobs].ID=dbo_jobs.Employee3Id) WHERE EXISTS (SELECT [Edited Jobs].TITLE FROM [Edited Jobs] WHERE [Edited Jobs].ID = dbo_jobs.Employee3Id);"

dbConnection.Execute StrSQL
Also, how can i split up my StrSQL string so its not on one line?
Thanks!

J
Jane 3/6/2009

Hi,
It's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.

R
Roger 3/7/2009

Parker you can concat the string like so:
StrSQL = "UPDATE dbo_jobs SET JobName = (SELECT [Edited Jobs].TITLE FROM [Edited Jobs] WHERE"

StrSQL = SqtSQL & " [Edited Jobs].ID=dbo_jobs.Employee3Id) WHERE EXISTS (SELECT [Edited Jobs].TITLE FROM [Edited Jobs] "

StrSQL = SqtSQL & " WHERE [Edited Jobs].ID = dbo_jobs.Employee3Id);"
dbConnection.Execute StrSQL
I've broken it up at some realisticly easy to read sposts, but you can do this to the string anywhere.
I hope this is what you are asking for, if not oopppsss...
As for the NZ, I don't know. If you enable debugging and display your slqstatements, it may help...
One little trick that I've used is to assign the value of the SQL statement to a session vaiable and use it in a display field on a form.
That one really helps as sometimes the SQL statement is displayed and replaced by other data very quickly.
Hope this helps.

J
James_Parker author 3/9/2009

Thanks guys. Yep, concatenating the string is what i was after thanks Roger.
the other problem - 'undefined Nz...' was because there was something wrong with my table [Edited Jobs]. This table was actually a select query in access. I got round it by duplicating another query and changing the sql statement.
I didn't know there was a debug mode so i'll get straight into that.
Thanks again

Sergey Kornilov admin 3/9/2009

Nz is one of functions that works in MS Access only. Make sure you are not using it in ASPRunnerPro or even in MS Access query.