"Expected: =" error

A

Anthony

Hi,

My VBA knowledge is quite limited

I have a function:
-----
Function Update2ndYrDate(txtcustid As String, dteDue As Date)

Dim SQL As String

If MsgBox("Is this client entering the 2nd year of the contract?", vbYesNo)
= vbYes Then

SQL = "UPDATE tblcustomer SET tblcustomer.dte2ndYearStart = #" & dteDue
& "# WHERE (((tblcustomer.CustomerID)=" & txtcustid & "));"
DoCmd.RunSQL SQL
End If

End Function
-----

When I Type the following:
Update2ndYrDate (Me.CustomerID,me.DatePaymentDue )

I get a error "Expected: ="

Could anybody give me some advice on this one.
I can't work out what I am doing wrong.

Thanks in advance.

Anthony
 
K

Ken Snell \(MVP\)

When you don't use Call, you don't need parentheses. Either of these will
work:

Call Update2ndYrDate (Me.CustomerID,me.DatePaymentDue )

or

Update2ndYrDate Me.CustomerID,me.DatePaymentDue
 
A

Anthony

Thanks so much Ken worked perfectly.



Ken Snell (MVP) said:
When you don't use Call, you don't need parentheses. Either of these will
work:

Call Update2ndYrDate (Me.CustomerID,me.DatePaymentDue )

or

Update2ndYrDate Me.CustomerID,me.DatePaymentDue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top