Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA 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 16th, 2006, 11:01 PM
Authorized User
 
Join Date: Jun 2003
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default Runtime Error 2427

I have searched all over the net an found results of problems similar to this but not exactly what i want. My Scenario is... I have 4 check boxes that i use to order a form bound to a table. The problem is every time i try to check the value of the check box i get

"Runtime Error 2427"
"You entered an expression that has no value"

The code on the GotFocus of the check boxes is...

If Me.chkAscend.Value = True Then 'Error occurs here
     Me.OrderByOn = True
     Me.OrderBy = "fldDateIn Asc"
Else
     Me.OrderByOn = True
     Me.OrderBy = "fldDateIn Desc"
End If

Please help coz this is giving me unwanted headaches

LION OF JUDDAH!
__________________
LION OF JUDDAH!
 
Old July 17th, 2006, 03:25 AM
Friend of Wrox
 
Join Date: Jul 2005
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try removing the .Value like this:

If Me.chkAscend = True



Boyd
"Hi Tech Coach"
Access Based Accounting/Business Solutions developer.
http://www.officeprogramming.com
 
Old July 17th, 2006, 05:41 AM
Authorized User
 
Join Date: Jun 2003
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried all that.. en still not working. Funny thing is i have tried the same operation with a toggle button en its working fine plus the expression tglButton.Value.

Am still hoping to get an answer thank you.

LION OF JUDDAH!
 
Old July 17th, 2006, 07:40 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

Well, you can simplify your code like this

Me.OrderByOn = True

If Me.chkAscend Then
    Me.OrderBy = "fldDateIn Asc"
Else
    Me.OrderBy = "fldDateIn Desc"
End If

Because an IF statement resolves to true or false and a checkbox is either true or false...

EXCEPT if you have a triple state property set to yes. In that case, it can be NULL and it could be the source of your error. Make sure the triple state property is set to no and your checkbox has a default value of either true or false.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old July 17th, 2006, 09:10 PM
Authorized User
 
Join Date: Jun 2003
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Actually the problem was alittle tricky than that. I figured out that Access has changed the way it handles optiongroups drastically over the past version. Initially option boxes within a frame could be handled independently and codes like the one I was having problems with would have worked.

Now, Optiongroup members have optionvalue which is set to the value of the frame holding the option boxes. That’s why my code was not working. So I eventually changed my code to.

‘Note: Option1.Optionvalue = 1
‘Note: Option2.Optionvalue = 2

Select Case fraOrderBy.Value
Case 1
If Me.chkAscend.Value = True Then
     Me.OrderByOn = True
     Me.OrderBy = "fldDateIn Asc"
Else
     Me.OrderByOn = True
     Me.OrderBy = "fldDateIn Desc"
End If
Case 2
If Me.chkAscend.Value = True Then Me.OrderByOn = True
         Me.OrderBy = "fldDateOut Asc"
Else
     Me.OrderByOn = True
     Me.OrderBy = "fldDateOut Desc"
End if
End Select
Another mistake I created was including the chkAscend control in the same optiongroup as other option boxes when it wasn’t.

Thanks to all those who tried helping


LION OF JUDDAH!





Similar Threads
Thread Thread Starter Forum Replies Last Post
hi i got runtime error 13 Type Mismatch error sriharsha345 Access VBA 2 February 21st, 2008 09:30 AM
runtime error dhoward VB.NET 2002/2003 Basics 2 November 1st, 2007 03:30 PM
runtime error??? jeffreyJS ASP.NET 2.0 Basics 4 September 14th, 2006 04:07 AM
mysterious error runtime error '451' coyotworks Excel VBA 1 May 12th, 2006 03:57 PM
Runtime Error rwiethorn ASP.NET 1.0 and 1.1 Basics 1 January 27th, 2004 02:01 PM





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