Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 31st, 2006, 08:49 AM
Authorized User
 
Join Date: Aug 2005
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default Object Required Error

I have a form that opens another form when a command button is clicked. This newly opened form has this code on load:

Private Sub Form_Load()
 If [Forms]![frmCDs]![luwSoftware].Value Is Not Null Then
    List1.RowSource = "qrySW6"
    ElseIf [Forms]![frmCDs]![luwSoftware].Value Is Null Then
    List1.RowSource = "qrySW"
 End If
End Sub

It keeps returning the "Object Required" error message. frmCDs!luwSoftware exists... so I'm confused as to why this won't work.

 
Old July 31st, 2006, 08:54 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Hi Jeff,

I was struggling with something like this yesterday. I think what ended up working was something in the format...

Forms!frmCDs.luwSoftware.Value Is Not Null Then

If that doesn't work, try just...

Forms!frmCDs.luwSoftware Is Not Null Then

And if that doesn't work we could try some other things.

Mike

Mike
EchoVue.com
 
Old July 31st, 2006, 08:58 AM
Authorized User
 
Join Date: Aug 2005
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Neither of those worked. But it will work if I use, say:

Forms!frmCDs!luwSoftware.Value = 7 Then

So I'm thinking maybe it doesn't like the null thing. Any ideas?
 
Old July 31st, 2006, 09:04 AM
Authorized User
 
Join Date: Aug 2005
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Silly me. Is Not Null is a SQL thing, and is not recognized by VBA. Instead, I had to use IsNull().

Private Sub Form_Load()
If IsNull(Forms!frmCDs!luwSoftware.Value) = False Then
    List1.RowSource = "qrySW6"
    ElseIf IsNull([Forms]![frmCDs].[luwSoftware]) = True Then
    List1.RowSource = "qrySW"
End If
End Sub

There we go. Thanks anyway Mike.
 
Old October 1st, 2009, 06:08 AM
Registered User
 
Join Date: Oct 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I too just wanted to say thank you. Looking at my code, adding better handling etc did not help. I too had used the SQL code instead of th VBA.

I'm soooo pleased to move on...
Ta very much!
 
Old October 2nd, 2009, 08:09 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Simplified, it would be

Code:
Private Sub Form_Load()
 
    If IsNull(Forms.frmCDs.Form.luwSoftware) Then
        Me.List1.RowSource = "qrySW"
    Else
        Me.List1.RowSource = "qrySW6"
    End If
 
End Sub
__________________
Greg Serrano
Michigan Dept. of Environmental Quality
Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
Object Required error voyeur Javascript 9 January 25th, 2008 11:50 AM
Compile Error: Object required DeannaF829 Beginning VB 6 1 April 24th, 2007 07:12 AM
MSXML Object Required Error??? kevorkian Classic ASP Basics 1 January 5th, 2007 12:43 PM
Object required error ?? hman SQL Server ASP 11 June 21st, 2004 10:59 AM
error....Object required: '' sassenach Classic ASP Databases 2 August 4th, 2003 03:27 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.