Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

How to handle 0 records returned via ODBC connection?


Not applicable


I am connecting my form via ODBC to an MS Access database with FormCalc XFA.  I know that's not ideal, but it works.   I am stuck however on how to handle errors when the form is not able to return a record due to a bad search string.

Typically I am expecting one unique record to be returned, however at times there is no match based upon what the user has entered into the search field.  I am trying to 'catch' the error and give them a custom message I write, or no error at all.

My Data Connection name is:   EstabSearchResults

My search field name is:   EstabSearchField

Here is what is run on the On Exit event when the user leaves the EstabSearchField:

var oDC = Ref($sourceSet.EstabSearchResults.clone(1))

oDC.#command.query.commandType = "text" = concat("SELECT Blah, BLah2, Foo, Bar FROM TableName WHERE (Something LIKE '",EstabSearchField.rawValue,"');")


If there's now records however, I get:    [A whole bunch of Adobe gibberish that makes sense to end-users]  Error:  No records in datasource. 

I'm having a difficult time coming up with a way to handle it when there is no records and perform addition customized logic if that happens.

Any ideas?



0 Replies