I am trying to create a procedure that has values are entered into a
table that based on the value entered will programatically decide
weather or not the Yes/No should be checked. I am trying to use the
Dlookup command so that it looks to another table to get the values to
compare to - I want to use the Dlookup command so that if the
acceptable ranges change that a user wouldn't have to get into the VB
code to make the change happen.
Here is the code....
Set MyDB = DBEngine.Workspaces(0).Databases(0)
Set MyTable = MyDB.OpenRecordset("TPtest", DB_OPEN_TABLE)
MyTable.AddNew
' add a new record - the new record becomes the current record
MyTable("Serial Number") = MyData1
' write our data to a field named "SerialData"
MyTable("Pressure") = MyData2
'preform data check
LR = DLookup("[LowRange]", "TestValues", "[TestName]=Pressure")
**get error 2001 cancel previous operation here and quits**
HR = DLookup("[HighRange]", "TestValues", "[TestName]=Pressure")
If MyData2 > "LR" And MyData2 < "HR" Then
MyTable("PressureCK") = -1
End If
If I hard code values into the IF statements it works as expected - I
just would really like to have the testing ranges kept on another
table to be accessed accordingly.
TIA