Verifying values

  • Thread starter Thread starter ftomas
  • Start date Start date
F

ftomas

Guest
Hi
I have a form (eti) that is linked to a table (eti_tl)
i have to text fields NOME and ENT

In the property form_before_update i want to make this verify:

If there is in the table some record with the same value for the field NOME
If there is in the table some record with the same value for the field ENT

If there is equal value for Nome and a ENT, i want to cancel the update ou to echo a msg, even if Nome or ENT are Null

I try Dlookup
if me.nome = dlookup ("Nome", "eti") then
msgbox "problem!"
end if
But he only verifys the first record

Thanks for any help.... or any idea hoew to make it work in other way :)
 
You could try with something like:

Dim db as database
Dim rs as recordset

Set db = CurrentDb
Set rs = db.OpenRecordSet("SELECT NOME, ENT FROM eti_tl WHERE NOME _' " & Me!nome & "' AND ENT = '" & Me!ent &"';")

If Not rs.EOF then
rs.close
Set db = Nothing
Exit Sub
End If

HTH

Filippo
 

Users who are viewing this thread

Back
Top Bottom