Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 31st, 2006, 08:49 AM
Authorized User
 
Join Date: Aug 2005
Location: , , .
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.

Reply With Quote
  #2 (permalink)  
Old July 31st, 2006, 08:54 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
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
Reply With Quote
  #3 (permalink)  
Old July 31st, 2006, 08:58 AM
Authorized User
 
Join Date: Aug 2005
Location: , , .
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?
Reply With Quote
  #4 (permalink)  
Old July 31st, 2006, 09:04 AM
Authorized User
 
Join Date: Aug 2005
Location: , , .
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.
Reply With Quote
  #5 (permalink)  
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!
Reply With Quote
  #6 (permalink)  
Old October 2nd, 2009, 08:09 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 02:18 PM.


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