Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If Control Exists Then Yes Else No

Status
Not open for further replies.

zevw

MIS
Jul 3, 2001
697
US
Is there a function Like NZ which will do the following!

If the control exists on this form then send this message otherwise do the other. I need this for error trapping.

Any help would be greatly appreciated.

 
Something like this ?
On Error Resume Next
If UCase(Me(strControl).Name) = UCase(strControl) Then
MsgBox "this message"
Else
MsgBox "the other message"
End If

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I"m sorry but what does strcontrol represent

Lets say strcontol = CustomerId

What I am trying to check if the control customerid exists in this form or not if it does not exist it will give you an error.

 
Try something like this:
On Error Resume Next
If Me("CustomerId").Name <> "CustomerId" Then
MsgBox "error message"
End If


Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top