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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object required error 1

Status
Not open for further replies.

dkwong

MIS
Dec 27, 2001
76
CA
I can't figure out why there's this error in my VBA code:

If Me.AccMgr_Client_Code Is Null Then
[b.Client_Code].Value = [Client_Code]
End If

This gives an "object required run time error '424'" on the first line. I want to check if a textbox is null and if it is to assign a value to it. Thanks!
 
Textbox controls are never null. What you really want to do is check if its text is empty.
 
I'm pretty sure the "IsNull" should look like this:

If IsNull(Me!AccMgr_Client_Code) Then
[b.Client_Code].Value = [Client_Code]
End If

But in some cases you'll have a zero-length string "" which this won't catch. The way to get both at the same time is to use something like this:

If Len(Me!AccMgr_Client_Code & "") = 0 Then
[b.Client_Code].Value = [Client_Code]
End If

Kyle [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top