DaiDreamer
Programmer
Hi!
I'm new to the whole VBS and Access Programming thing. Can some one help me? I'm trying to count the number of times a table feild comes up with true. But when i try to display the value in the form, it only says "#Name?" in where I call the function and where I try to display something from the table.
Here's my code:
Function MineTypeFun(MineType As String) As String
Dim DBL As Database
'Dim WS As Workspace
Dim RS As Recordset
Dim Counter As Integer
Dim Counter500 As Integer
'Set WS = Workspaces(0)
Set DBL = CurrentDb()
Set RS = DBL.OpenRecordset("tblInsp99"
Counter = 0
Counter500 = 0
RS.Index = "My Index"
Debug.Print "Testing"
RS.MoveFirst
Do Until RS.EOF
If RS.Fields(MineType) = True Then
Counter = Counter + 1
End If
RS.NextRecordset
Loop
DBL.Close
RS.Close
'WS.Close
MineTypeFun = "Testing"
End Function
I'm new to the whole VBS and Access Programming thing. Can some one help me? I'm trying to count the number of times a table feild comes up with true. But when i try to display the value in the form, it only says "#Name?" in where I call the function and where I try to display something from the table.
Here's my code:
Function MineTypeFun(MineType As String) As String
Dim DBL As Database
'Dim WS As Workspace
Dim RS As Recordset
Dim Counter As Integer
Dim Counter500 As Integer
'Set WS = Workspaces(0)
Set DBL = CurrentDb()
Set RS = DBL.OpenRecordset("tblInsp99"
Counter = 0
Counter500 = 0
RS.Index = "My Index"
Debug.Print "Testing"
RS.MoveFirst
Do Until RS.EOF
If RS.Fields(MineType) = True Then
Counter = Counter + 1
End If
RS.NextRecordset
Loop
DBL.Close
RS.Close
'WS.Close
MineTypeFun = "Testing"
End Function