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

Passing parameters to VB6.

Status
Not open for further replies.

donutman

Programmer
Dec 20, 2002
2,481
US
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:
Code:
   Parameters SearchText text(255);
   Insert into SearchResult
      Select ID from MyTable where Title like SearchText;
In VB:
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
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]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top