|
|
 |
| 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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

July 31st, 2006, 09:49 AM
|
|
Authorized User
|
|
Join Date: Aug 2005
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

July 31st, 2006, 09:54 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

July 31st, 2006, 09:58 AM
|
|
Authorized User
|
|
Join Date: Aug 2005
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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?
|

July 31st, 2006, 10:04 AM
|
|
Authorized User
|
|
Join Date: Aug 2005
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

October 1st, 2009, 07:08 AM
|
|
Registered User
|
|
Join Date: Oct 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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!
|

October 2nd, 2009, 09:09 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,114
Thanks: 2
Thanked 4 Times in 4 Posts
|
|
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
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |