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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

syntax question

Status
Not open for further replies.

dumdum2

Programmer
Mar 18, 2000
98
GB
Is it possible to use a select statement for a query instead of a table? If so, what is the syntax?

With rst
.PageSize = 8
.ActiveConnection = cn
.Source = "SELECT * FROM 'search query'"
.LockType = adLockOptimistic
.CursorType = adOpenStatic
.Open
End With

Thanks-
 
Perhaps this ?
.Source = "SELECT * FROM [search query]"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks, I tried that but I'm still getting a run-time error: "No value given for one or more parameters" and stops on the .Open command. So I guess the Select statement is working, but something must be wrong with the query.....?
 
AFAIK you can't use a parametized query in ADO ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
guess i am dumb....what is AFAIK ?

how best can i narrow the recordset?
 
ah ha.....

do you know how i can narrow the recordset?
 
Thanks, I tried that also--but it didn't work.......I replaced the select statement with the sql statement....is that the wrong place to put it??
 
SELECT timage.*, InStr([Keywords],[Forms]![search]![searchtext]) AS Expr1
FROM timage
WHERE (((InStr([Keywords],[Forms]![search]![searchtext]))>0));


thanks-
 
Perhaps this ?
Code:
.Source = "SELECT timage.*, InStr([Keywords],'" & [Forms]![search]![searchtext] & "') AS Expr1" _
 & " FROM timage WHERE InStr([Keywords],'" & [Forms]![search]![searchtext] & "'))>0"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top