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

how can i delete a query after execute it?

Status
Not open for further replies.

arepia

Programmer
Oct 3, 2002
2
CZ
hi
i have a problem in my program
-----------------------------------------

Private Sub bDel_Click()
Dim MyDB As Database
Dim MyQ As QueryDef
Set MyDB = OpenDatabase("C:\Prggolsar\dbgolsar.mdb")
Set MyQ = MyDB.CreateQueryDef("Q3")
MyQ.SQL = "DELETE * From tblOrder WHERE (((IDNo)= " & Me.gAllRec.object & " ))"
MyQ.Execute
MyDB.QueryDefs.Delete ("q3")
Unload frmAllRec
frmAllRec.Show
If gAllRec.object = "" Then
Me.bGotoRec.Enabled = False
End If
MsgBox "message",48, "this record has deleted"
End Sub
-------------------------------------------------

when i run my program,it has error that the q3 in alredy exict
i delete it after execute
but it creat it in accsess and dont delet it
what am i doing?
please help me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top