This article illustrates how to return a value that has not been recorded in the Elipse E3 Database yet.
Many times, you will need to check if a certain value has already been recorded in the Database before you try to add it. This is very important, especially when using a primary key.
First of all, SetVariableValue method atributes the value of a variable created on the Query; thus, you can inform this value as a filter or parameter before the Query takes place. You must also set up the variable’s name (VarName) and its (Value), which can be a number, a text, or a timestamp.
EOF property, from GetADORecordSet method, returns one of the following values: True, if the current record position is after the last onde, and False, if the current record position is before the last one.
With these two methods as resources, you must first search for the desired word:
- Set Consulta = Screen.Item(“ExistConsult”)
- ‘Screen.Item(“ExistConsult”).SetVariableValue(VarName, Value)
- Consulta.SetVariableValue “office”, Screen.Item(“TextExist”).Value
If you can’t retrieve the word, EOF property, from GetADORecordSet method, returns True:
- set RS = Consulta.GetADORecordset()
- If RS.eof = true Then
- msgbox “The office does not exist”
- msgbox “The office exists”
- end if
Therefore, you can indicate to the user if the value has already been recorded to the Database or not, or rather, of it will return a value that hasn’t been recorded in the Database.
Attached to this article is a demo application developed with Elipse E3 v5.0.437.