@dbLookup Woes

I am trying to access another db on our server with a test piece of code:

@If(@DbLookup(“”:“”; “”:“ourconta.nsf”; “Contact”; CompanyName) = “NN”; “Got it”; “Don’t got it”)

But when I test it, I keep getting an error saying that that view doesn’t exist on that db.

Any ideas what I’m doing wrong?

Subject: @dbLookup Woes

You need the server in there. You’ve left it blank, so it will try to look for the database on your hard drive!

@DbLookup(“”:“”; “servername”:“ourconta.nsf”; “Contact”; CompanyName)

If the database is on the same server as the one where your code is running, then use:

@DbLookup(“”:“”; @Subset(@DBName; 1):“ourconta.nsf”; “Contact”; CompanyName)

It’s never a good idea to hard code server names.

Cheers,

  • Mike

Subject: RE: @dbLookup Woes

Thanks chaps! That was extremely helpful.

Cheers

Subject: @dbLookup Woes

Your formula should look like this:@If(

@iferror(@DbLookup(“”:“”; @dbname[1]:“ourconta.nsf”; “Contact”;CompanyName;1);“Error”) = “NN”;

“Got it”;

“Don’t got it”) ;

You need to add the column you want to return ro the name of the field you want to return.

If you hardcode the name of the database, it may be a better idea to use the replica id, to accomodate local users. Anyway, add the servername, to be on the safe side.

And when you use @dblookup/@dbcolumns, always do error checking, and catch the error. It’s always possible the @dblookup to another database fails (db is corrupt, no network, running on local when you should be running on a server, …)

cheers,

Tom