Results 1 to 5 of 5

Thread: Scrabble

  1. #1
    Join Date
    Sep 2003
    Location
    London, England
    Posts
    52

    Unanswered: Scrabble

    I wanted to evaluate the Scrabble value of words in a dictionary; first I wrote a module to define the value of each letter, starting like this:

    Public Function Scrabble(Letter As Variant) As Integer
    'Function for converting letters into Scrabble values
    .....

    Then I wrote another module that calls the first one:

    Public Function Points()
    Dim i As Integer
    Dim Points As Integer
    Points = 0
    i = 1
    Do While i <= Len([Word])
    Points = Points + Scrabble(Mid([Word], i, 1))
    i = i + 1
    Loop

    End Function

    When I used this in a query I get the error message “undefined function 'Points' in expression”
    Clearly I have done something wrong. Please can you help, I am a beginner when it comes to writing code in a module.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    what line is the error reported on?
    my guess is that its going to be when you declare the points variable

    Code:
    Public Function Points() as integer
    Dim i As Integer
    Points = 0
    i = 1
    Do While i <= Len([Word])
    Points = Points + Scrabble(Mid([Word], i, 1))
    i = i + 1
    Loop
    End Function
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Sep 2003
    Location
    London, England
    Posts
    52

    Still scrabbling

    Thank you for your prompt reply, Healdem.

    I have corrected the code for my Public Function Points() to what you suggest but the error message is the same.

    I am trying to use the following as a field in a query (where [Word] is the word in a table):
    Scrab: Points([Word])

  4. #4
    Join Date
    Sep 2003
    Location
    London, England
    Posts
    52

    One stupid error less

    I had named the module Points and I now realise this is a problem since it is the function itself and so I have changed its name.

    Now there is a new error: Wrong number of arguments used with function in query expression ‘Points([Word]’

    Strange that the last ) is missing.

    Any ideas?

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so your function declaration expects no parameters, yet your call supplies a parameter
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •