graviz
Registered User.
- Local time
- Today, 10:09
- Joined
- Aug 4, 2009
- Messages
- 167
Lookup Table
Name: "Code_Test"
Fields:
Code: A 2 Digit Text Field
Price: A number amount
Example of values in the table:
CV / 45
~R / 15
I first wrote some code to determine if any of the codes in the "Code_Test" table is in the service_code_string field of a record (as seen below). It works great however I'd like to adjust it to do some addition.
Each record has a service code string as seen below.
What I'd like to do is sum up the value of each record using the code_test table. In this example I'd like the value of my function to yield 60 (45+15). I hope this makes sense. Thanks!!!
Name: "Code_Test"
Fields:
Code: A 2 Digit Text Field
Price: A number amount
Example of values in the table:
CV / 45
~R / 15
I first wrote some code to determine if any of the codes in the "Code_Test" table is in the service_code_string field of a record (as seen below). It works great however I'd like to adjust it to do some addition.
Code:
Function CodeFind(service_code_string As String) As Integer
Dim DB As DAO.Database
Dim Code_RS As DAO.Recordset
Set DB = CurrentDb()
Set Code_RS = DB.OpenRecordset("Code_Test")
Code_RS.MoveFirst
Do While Not Code_RS.EOF
If InStr(service_code_string, Code_RS!Code) Then
CodeFind = 1
Exit Function
End If
Code_RS.MoveNext
Loop
CodeFind = 0
End Function
Each record has a service code string as seen below.
Code:
P2|~R|8(|5U|96|NI|#.|OB|CV|**|0$