Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to translate a WHERE statement

Status
Not open for further replies.

MikeCDPQ

Technical User
Sep 11, 2003
173
CA
I am new to VB and need help

I have the following script which basically works with 2 spreadsheets: Active Sheet & EmailList
....(Set EmailList = GetObject("G:\Departmen.......

The script looks up a vendor number in EmailList finds it and uses the correponding email address to send email.
So far so good.

Now the problem: if vendor number is not found on email list, I want to lookup the buyer number instead and use this address

basically what I need is the syntax to amount to: LOOKUP buyer email on EmailList WHERE buyerno = activesheet buyerno
 
Hi,

Your SQL/procedure will either have to SELECT both values and the determine which to use, or make the first call for vendor number and if no records are returned make another for buyer.

:)

Skip,
Skip@TheOfficeExperts.com
 
Hi,

Still struggling with it but I will a way.

Thanks,
 
If you are looking for a way to incorporate a value into your SQL...
Code:
sQuery "SELECT * FROM MyTable WHERE Vendor='" & sVendor & "' "
Is this what you're looking for?

Skip,
Skip@TheOfficeExperts.com
 
Thanks SkipVought,

I will have to see on Monday at work but I need a script for an Excel VBA procedure. Is that going to do the trick?
I was looking in the HELP and could not find anything about a WHERE clause.

If it is a VBA script, it should work. It is exactly what I need.

Thanks again.

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top