×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Formula logic problem on @dblookup

Formula logic problem on @dblookup

Formula logic problem on @dblookup

(OP)
Hi everyone,

I have a field, that looks up values from a view, but if a value is not included in the view, it gives an Error message. Is their a way I can change this to give a more meaningfull error message. by the way, I do want the users to enter codes which are not in the view. Each time the document is refreshed it goes back to the standard error message. I'm having a problem getting the logic right in the formula.

Any help would be great, thanks.

This code runs in a field called Desc1

@If(StockCode1 !="" ;@DbLookup("";"server":"db.nsf";"myView";StockCode1;2);Desc1)

This script runs on QuerySave

If uidoc.fieldcontains("Desc1","ERROR") Then
  Call uidoc.FieldSetText("Desc1","Code not in database.")
End If

RE: Formula logic problem on @dblookup

You need to assign the lookup to a variable directly, before passing the result to the field :

LkpResult:=@If(StockCode1 !="" ;@DbLookup("";"server":"db.nsf";"myView";StockCode1;2);Desc1);
@if(@iserror(LkpResult);"Code not in database.";LkpResult)


By doing that, you eliminate the popup message and can control directly in the field the result. That also eliminates the QuerySave code.

RE: Formula logic problem on @dblookup

(OP)
Thanks very much, that worked a treat

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close