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

run time error 424 object required 1

Status
Not open for further replies.

beckyh

Programmer
Apr 27, 2001
126
US
I am using the following code
Code:
Private Sub Form_Load()



If Forms![MasterDemoApplication]![AccountNumber] Is Null Or Forms![MasterDemoApplication]![AccountNumber] Like "" Then
    oldCustomer.Visible = True
    oldCustomerContactPhone.Visible = True
    oldCustomerContactFax = True
    Customer.Visible = False
    CustomerContactPhone.Visible = False
    CustomerContactFax.Visible = False

Else
    Customer.Visible = True
    CustomerContactPhone.Visible = True
    CustomerContactFax.Visible = True
    oldCustomer.Visible = False
    oldCustomerContactPhone.Visible = False
    oldCustomerContactFax = False
  
End If
End Sub
Any idea why I get this error? I am referencing DAO 3.6 library and ADO 2.8 library.
 
Is the form you are loading MasterDemoApplication?
If so you are testing data values before any are present.
You need to wait til the Current event.
 
If you're testing for Null, try this in stead:

[tt]If trim$(Forms![MasterDemoApplication]![AccountNumber] & "") = "" Then[/tt]

I like to prefix references to form controls with Me!

[tt]Me!oldCustomer.Visible = True[/tt]

You are aware that you're assigning the value False to the oldCustomerContactFax in the last line of the Else clause? Should you be toggling the .Visible proeprty in stead?

Roy-Vidar
 
I ended up using
Code:
If Nz(Forms![MasterDemoApplication]![AccountNumber]) = "" Then

good eye royvidar!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top