I don't use Access very much, but I have the need to create a query in Access that has a parameter. How do I set the parameter in VB6. I've done it many times with SQL Server, but the same technique of creating a command object and refreshing the parameter collection doesn't work with an Access query. Here's what I've done.
In Access:
In VB:
This approach works with SQL Server but doesn't with Access. What should I do?
-Karl
[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
In Access:
Code:
Parameters SearchText text(255);
Insert into SearchResult
Select ID from MyTable where Title like SearchText;
Code:
Dim adoCmdSearch as adodb.command
set adoCmdSearch = new adodb.command
with adoCmdSearch
.connectionstring = "Jet etc."
.commandtype=adstoreproc
.commandtext=above Access query
.parameters.refresh
.parameters(1)="FindMe"
.execute
end with
-Karl
[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]