Function ExecuteProcedureAdox() 'Purpose: Execute a parameter query using ADOX. Dim cat As New ADOX.Catalog Dim cmd As ADODB.Command Dim lngCount As Long 'Initialize. cat.ActiveConnection = CurrentProject.Connection Set cmd = cat.Procedures("qryAdoxDeleteBooking").Command 'Supply the parameters cmd.Parameters("StartDate") = #1/1/2004# cmd.Parameters("EndDate") = #12/31/2004# 'Execute the procedure cmd.Execute lngCount Debug.Print lngCount & " record(s) deleted." 'Alternative: specify the parameters in a variant array. 'cmd.Execute , Array(#1/1/2004#, #12/31/2004#) 'Clean up. Set cmd = Nothing Set cat = Nothing End Function
Tuesday, 26 June 2012
Ex16: VBA - Execute a parameter query using ADOX
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment