IF Statement

  • Thread starter Thread starter DS
  • Start date Start date
D

DS

Hi, I need to write an IF statement.
I have a field called "Display" that has a number in it. I want to
search a Table "Employees" to see if that number matches. IF it matches
then it will open the "ORDER" Form, IF it doesn't the a "Message Box
will be displayed. Any ideas?
DS
 
DS said:
Hi, I need to write an IF statement.
I have a field called "Display" that has a number in it. I want to
search a Table "Employees" to see if that number matches. IF it
matches then it will open the "ORDER" Form, IF it doesn't the a
"Message Box will be displayed. Any ideas?

I suspect that the best way would be to build a combobox to lookup the
employee number (although doing it by name makes more sense to me), then
using the not in list event if the name dooes not appear.
Msgbox "Your message" is all that is needed.
 
I guess you meant a Control "Display" on the current
Form. Try something like:

If DCount("*", "Employees", "[TableField] = " &
Me.Display) > 0 Then
DoCmd.OpenForm "ORDER", ...

Else
MsgBox ...
End If

HTH
Van T. Dinh
MVP (Access)
 
Van said:
I guess you meant a Control "Display" on the current
Form. Try something like:

If DCount("*", "Employees", "[TableField] = " &
Me.Display) > 0 Then
DoCmd.OpenForm "ORDER", ...

Else
MsgBox ...
End If

HTH
Van T. Dinh
MVP (Access)



-----Original Message-----
Hi, I need to write an IF statement.
I have a field called "Display" that has a number in it.

I want to
search a Table "Employees" to see if that number

matches. IF it matches
then it will open the "ORDER" Form, IF it doesn't the

a "Message Box
will be displayed. Any ideas?
DS
.
Wow...Thank you. I appreciate the response. I'll try it now.
DS
 
DS said:
Van said:
I guess you meant a Control "Display" on the current Form. Try
something like:

If DCount("*", "Employees", "[TableField] = " & Me.Display) > 0 Then
DoCmd.OpenForm "ORDER", ...

Else
MsgBox ...
End If

HTH
Van T. Dinh
MVP (Access)



-----Original Message-----
Hi, I need to write an IF statement.
I have a field called "Display" that has a number in it.


I want to
search a Table "Employees" to see if that number


matches. IF it matches
then it will open the "ORDER" Form, IF it doesn't the


a "Message Box
will be displayed. Any ideas?
DS
.
Wow...Thank you. I appreciate the response. I'll try it now.
DS
Thank You! Thank You! Thank You!
I played with it and it works. You've made my day!
DS
 
Back
Top