Hi Trevor. There are a number of problems in your code extract, which is not going to run just yet. A skeleton that opens a table or query and checks for the value you are trying to match is listed below.
- Dim rst as DAO.RecordSet
-
Dim ValueFound as Boolean
-
ValueFound = False
-
set rst = CurrentDB.OpenRecordset("name of your query or table")
-
Do While Not rst.EOF
-
ValueFound = rst![CallType] = "N/A"
-
rst.Movenext
-
Loop
-
rst.Close
-
If ValueFound then
-
{do stuff}
-
else
-
{do something else}
-
endif
I guess when you say a textbox you mean a combo or a listbox. It is the recordsource for this you would need to open in the code above.
Personally, I'd use Access queries for this - which you can access using functions such as DLookup in code if you have to. The problem with taking a programmed approach is that all of the logic is hidden away from the users and maintainers of your application. Anyway, that's just my approach to it.
-Stewart