undefined fucntion

S

shank

I have the below function I used yesterday without issue. I'm using it in a
query. Today I get an Undefined Function error. I know this function was
harvested from an Access 97 MDB. Yet, it worked fine yesterday. I have the
following references checked and have included the query.

What is wrong? Does the function need to be updated in some way?
thanks!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
Visual Basic for Applications
Microsoft Access 10.0 Object Library
OLE Automation
Microsoft Office XP Web Components
Microsoft DAO 306 Object Library
Visual Basic for Applications Extensibility 5.3
Microsoft ActiveX Data Objects 2.1 Library
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
UPDATE FD SET FD.UPC = ("887118" & CStr(FD!DN) & "1") &
CInt((UPC_A_CheckDigit(887118 & FD!DN & 1)))
WHERE (((FD.DN)>1000));
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
Function UPC_A_CheckDigit(ByVal Number As String) As String
'
' Calculates check digit for 11-digit UPC-A codes.
' Codes of any other length get back an 'x'.
'
Dim Digit1 As Integer, Digit2 As Integer, i As Integer
If Len(Number) <> 11 Then
UPC_A_CheckDigit = "x" ' Dummy value - they're misusing the function
Else
Digit1 = 0
Digit2 = 0
For i = 2 To 10 Step 2
Digit1 = Digit1 + Val(Mid$(Number, i, 1))
Next i
For i = 1 To 11 Step 2
Digit2 = Digit2 + Val(Mid$(Number, i, 1))
Next i
UPC_A_CheckDigit = Chr$(((210 - (Digit2 * 3 + Digit1)) Mod 10) + 48)
End If
End Function
 
J

James Minns

shank said:
I have the below function I used yesterday without issue. I'm using it in a
query. Today I get an Undefined Function error.
UPDATE FD SET FD.UPC = ("887118" & CStr(FD!DN) & "1") &
CInt((UPC_A_CheckDigit(887118 & FD!DN & 1)))
WHERE (((FD.DN)>1000));
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Function UPC_A_CheckDigit(ByVal Number As String) As String []
End Function

Doesn't help you much, but your function and update query work fine on my
Access 2003, without any extra libraries...

James
 

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