SQL Problem

  • 19 years ago

    The code is:

    Private Sub Command1_Click()
       Dim d As Database
       Set db = OpenDatabase("C:\DB1.mdb")
       db.Execute "Update tbl SET tbl.a=FF(tbl.a) "
    End Sub
    Public Function FF(i As Integer) As Integer
       If IsNull(i) Then
           FF = 0
           FF = i
       End If
    End Function

    The Problem Is :
    the Compiler Give me this massge 'Undifne Function "FF" In Experstion'
    why?? and what the solution....

  • 19 years ago


    db.Execute "Update tbl SET tbl.a=" & FF(tbl.a)

    The database doesn't know anything about your FF function... you need VB to parse that bit first, and then put it into the string.

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.”