Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / July 2005

Tip: Looking for answers? Try searching our database.

Error Running Code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Edward Jones (Eddie) - 28 Jul 2005 17:29 GMT
I am recieving the following error when executing the following code in a
report:

Run-time error '2427':
You entered an expression that has no value.

Function ChangeColor(strErrCall As String)
On Error GoTo Err_ChangeColor
Select Case Me.chkPending
Case 0
   Me.Project_Number.ForeColor = -2147483643
   Me.Financial_Strip.ForeColor = -2147483643
   Me.Notes.ForeColor = -2147483643
Case -1
   Me.Project_Number.ForeColor = 16191485
   Me.Financial_Strip.ForeColor = 16191485
   Me.Notes.ForeColor = 16191485
End Select
Exit_ChangeColor:
   Exit Function
Err_ChangeBGColor:
   MsgBox Err.Description & strErrCall
   Resume Exit_ChangeBGColor
End Function

Private Sub Report_Open(Cancel As Integer)
   ChangeBGColor (" - Called from Report_Open.")
End Sub

I do not get this error if i execute the same code on a form. If i try
"MsgBox  Me.chkPending" i get the same error. I am trying to get the value of
a check box. Thank you for any help.
Tim Ferguson - 28 Jul 2005 18:15 GMT
"=?Utf-8?B?RWR3YXJkIEpvbmVzIChFZGRpZSk=?="
<EdwardJonesEddie@discussions.microsoft.com> wrote in
news:06EAF609-C18D-4970-8A42-56E4FAE8AD03@microsoft.com:

> I am recieving the following error when executing the following code
> in a report:

Remove the On Error line and find out which line is failing. I cannot
imagine what the error handling in this code is meant to achieve anyway.

B Wishes

Tim F
Edward Jones (Eddie) - 28 Jul 2005 18:29 GMT
It is failing on Me.chkPending stating that "You entered an expression that
has no value." Me.chkPending is a checkbox in the report. Thanks for the help.

> "=?Utf-8?B?RWR3YXJkIEpvbmVzIChFZGRpZSk=?="
> <EdwardJonesEddie@discussions.microsoft.com> wrote in
[quoted text clipped - 9 lines]
>
> Tim F
Tim Ferguson - 29 Jul 2005 17:56 GMT
"=?Utf-8?B?RWR3YXJkIEpvbmVzIChFZGRpZSk=?="
<EdwardJonesEddie@discussions.microsoft.com> wrote in
news:B277ADA3-4424-4A38-A03D-D70486AE3638@microsoft.com:

> It is failing on Me.chkPending stating that "You entered an expression
> that has no value." Me.chkPending is a checkbox in the report.

If it's control, then you need to address the controls collection. Try

 Me.Controls("chkPending")

or, for short

 Me!chkPending

Access only exposes fields in the recordsource as properties (i.e. visible
with the dot operator), not controls.

Hope that helps

Tim F
John Spencer (MVP) - 30 Jul 2005 01:16 GMT
If you are calling this from the report's open event, then I believe that the
control is not populated yet and is probably not available.  Perhaps you can get
the value you need some other way - using a DLookup function for example.

Also, I think you really need to call the function without the ()  as in
 ChangeBGColor " - Called from Report_Open."

> "=?Utf-8?B?RWR3YXJkIEpvbmVzIChFZGRpZSk=?="
> <EdwardJonesEddie@discussions.microsoft.com> wrote in
[quoted text clipped - 17 lines]
>
> Tim F
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.