MySQL Forums
Forum List  »  Microsoft Access

Re: How to run MySQL Stored Procedure in Access VBA?
Posted by: Daniel Hofer
Date: January 18, 2012 10:06AM

Until I get help on executing a MySQL SP in VBA, I'm using this instead.

Access query: qryUpdateLineitems

PARAMETERS pid Long;
UPDATE lineitems RIGHT JOIN (SELECT lineitems.ID, jobs.JOBNO, lineitems.EXTTOTAL, PRICE*UNITS*IIf(USEPRORATE,PRORATEP/100,1) AS NEWEXTTOTAL, jobs.PROJID FROM (lineitems INNER JOIN jobs ON lineitems.JOBNO = jobs.JOBNO) INNER JOIN biditems ON lineitems.ITEMID = biditems.ITEMID WHERE (((jobs.PROJID)=pid))) AS prep ON lineitems.ID = prep.Id SET lineitems.exttotal = newexttotal;

ADO Code:

Public Sub RecalcValues()
Dim cn As ADODB.Connection
Dim cmd As ADODB.Command
Dim pid As Long
pid = [PROJID]

'Use the ADO connection that Access uses
Set cn = CurrentProject.AccessConnection
Set cmd = New ADODB.Command

With cmd
.ActiveConnection = cn
.CommandText = "EXECUTE qryUpdateLineitems " & pid
.Execute
End With

Set cmd = Nothing
Set cn = Nothing

Me.Refresh

End Sub

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: How to run MySQL Stored Procedure in Access VBA?
5462
January 18, 2012 10:06AM
3082
February 23, 2012 09:51AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.