"Expected: =" error

  • Thread starter Thread starter Anthony
  • Start date Start date
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
 
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
 
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
 
Back
Top