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

I've got a combo box to select from

Status
Not open for further replies.

drctx

IS-IT--Management
May 20, 2003
226
US
I've got a combo box to select from and then it creates a stored procedure and tries to open it.
I get this error message when i select an item from the combo box: "microsoft access can't find the object 'zTest'. when i look at the querries it's not there until i hit F5 to refresh and it appears. is there any way for this to work with out having to manually refresh the querries?


Private Sub Combo7_AfterUpdate()
Dim splr As String
splr = Combo7.Text
Dim SPname As String
Dim SQLstr As String

SQLstr = "CREATE PROCEDURE zTest AS SELECT * FROM [Namelist - Suppliers] WHERE [Supplier:] = '" & splr & "'"
SPname = "zTest"
Me.Refresh
Text5 = SQLstr
DoCmd.RunSQL SQLstr
DoCmd.OpenStoredProcedure "zTest", acViewNormal, acEdit

End Sub
 
Hi,

You can do this a different way, create a stored procedure called z test then create a parameter for the supplier in the storesd procedure. Now open the stored procedure using the ADO command object, creating a command object parameter aswell and setting that to the value of the vb variable.

look up ado command object on google and it will show how to do this. Or if you can't be arsed I will supply you some code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top