How could I do comparison in Access?

C

Clarice Wu

I am using Access 2000 and I want to achieve a function as below:

After a user enter a data or text in a form, the satabase can compare the
input data with a data exists in another form.If they are the same, another
form will open. If they are different, a error message box will appear.

Thanks!

Clarice
 
A

Arvin Meyer

Sub MyCmdButton (Cancel As Integer)
If Me.txtBox1 = Forms!OtherForm!txtBox1 And _
Me.txtBox2 = Forms!OtherForm!txtBox2 And _
Me.txtBox3 = Forms!OtherForm!txtBox3 Then

DoCmd.OpenForm "Yet Another Form"
Else
MsgBox "Error message", vbOKOnly, "Error"
End If
End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access Downloads
http://www.datastrat.com
http://www.mvps.org/access
 
D

Dennis

if Forms!Form1.TextBox = Forms!Form2.TextBox then
docmd.OpenForm "Form3"
else
MsgBox "Error Message"
end if
 
Top