Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

var

Posted on 1999-06-26
8
Medium Priority
?
151 Views
Last Modified: 2010-05-02
I need the notation for the following sql where the varTable is not the actutual table name , it is a variable from my programme it varies according to some conditions. Also strFlag is not the actual field, I ran this but gave an error.


DSql = "SELECT * FROM varTable WHERE strFlag like 'D'"

many thanks
0
Comment
Question by:abidr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 10

Accepted Solution

by:
viktornet earned 80 total points
ID: 1519961
you could try this :)

DSql = "SELECT * FROM varTable WHERE strFlag like " & D

..-=ViKtOr=-..
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1519962
opps, sorry....

i misinterpretted your question...

what types are varTable and strFlag??

i guess strFlag is simply a string, but what is Table? a string too??

you should be able to do something like this...

DSql = "SELECT * FROM "&varTable&" WHERE "&strFlag&" like 'D'"

-vik-

..-=ViKtOr=-..
0
 

Author Comment

by:abidr
ID: 1519963
that was quick, I've just posted it. so is D at the ent a variable or just letter "D" as I want???
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:abidr
ID: 1519964
I have tested that it do not work. d is "D" fixed value in the field. The table will not work as it is now because it is a varible as i said earlier
0
 

Author Comment

by:abidr
ID: 1519965
I tried that
DSql = "SELECT * FROM "&varTable&" WHERE "&strFlag&" like 'D'"

 it gives syntax err.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1519966
ok, please tell me of what TYPES are varTable and strFlag.. e.g., are they strings?, variants?, please tell me....

..-=ViKtOr=-..
0
 

Author Comment

by:abidr
ID: 1519967
it ok my mistake, the last one you sent works
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1519968
hehe, great :)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question