Object Required Question.

CBG2112

Registered User.
Local time
Today, 16:11
Joined
Aug 4, 2009
Messages
32
Please help. I'm trying to pull every 5th record for a record that has PS3 as a console. I would like to change the ConsoleCt of Console_ID 1 with a value from 1 to 5. When it hits 5, it will mark a flag as yes, return ConsoleCt to 1, and restart the process again. I get an object required when running this code. Thanks.

Code:
Private Sub
.
.
.
.
    Case "PS3"
        Dim myConsole As Integer
        If myConsole = 5 Then
        Console_FL.Value = -1
        ConsoleCount (1)
        Else
        ConsoleCount = (myConsole + 1)
        End If
    End Select
End Sub
Code:
Function ConsoleCount()
Dim SQL As String
SQL = "UPDATE tblConsole SET ConsoleCt = ? WHERE Console_ID = 1 "

End Function
 
two issues.

Code:
[COLOR="Blue"]ConsoleCount (1)[/COLOR]
        Else
        [COLOR="blue"]ConsoleCount = (myConsole + 1)[/COLOR]
you're giving the function a param of '1' when it doesn't take any. it will error here, or should. I don't believe you can give a function a value without running it. value assignment has to take place in the actual function.

on a side note too, subroutines cannot return values, only functions can.
 

Users who are viewing this thread

Back
Top Bottom