?
Solved

Null value err encountered , Run-time error 2424

Posted on 2011-03-16
16
Medium Priority
?
587 Views
Last Modified: 2012-05-11

Hi:
Run-time error 2424
The expression you entered has a field, control, property name that
Microsoft Access can't find.
Would you See the photo please
How can I get rid of it please
Is it good code to put resume next in err handler of that err.number 2424?
Please help

1.png
0
Comment
Question by:Mohammad Alsolaiman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
  • 3
16 Comments
 
LVL 75
ID: 35151172
Possible spelling typo in

fnExtnesionExcessDays  ' does this exist or typo ?
Me.GuidanceID                 ' does this exist or typo ?
Me.GuidanceStartDate    ' does this exist or typo ?

mx
0
 
LVL 57

Expert Comment

by:HainKurt
ID: 35151339
+ this to above post

Me.GuidanceEndDate ' does this exist or typo ?
0
 
LVL 75
ID: 35151381
Check *all* Control/Field names on the Error line ...

mx
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

Author Comment

by:Mohammad Alsolaiman
ID: 35151510
yes, all Controls/Fields are there and with the same names.
and if there are a values in these fields it works properly
0
 
LVL 75
ID: 35151528
Show the code for this function:

fnExtnesionExcessDays  

mx
0
 
LVL 57

Accepted Solution

by:
HainKurt earned 750 total points
ID: 35151545
try this:

Me.ExtensionDays.value=Nz(fn(....), "1")

or

Me.ExtensionDays.text=Nz(fn(....), "1")

where "1" is dafault value if the function returns null (?)
0
 

Author Comment

by:Mohammad Alsolaiman
ID: 35151579
Here is the code
Option Compare Database
'************* Code Start *************
Public Function HowManyWD(FromDate As Date, _
                            ToDate As Date, _
                            WD As Long)
   ' No error handling actually supplied
    HowManyWD = DateDiff("ww", FromDate, ToDate, WD) _
                                 - Int(WD = Weekday(FromDate))
End Function
'************* Code End *************
'   In the same way, someone can easily get the number of weekdays (excluding weekends) by subtracting number of Sundays and Saturdays:

'************* Code Start *************
Public Function HowManyWeekDay(FromDate As Date, _
                            ToDate As Date, _
                            Optional ToDateIsIncluded As Boolean = True)
    ' ToDateIsIncluded: this is to calculate the last date or not. it deppends on you
    HowManyWeekDay = DateDiff("d", FromDate, ToDate) - _
                    ToDateIsIncluded - _
                    HowManyWD(FromDate, ToDate, vbThursday) - _
                    HowManyWD(FromDate, ToDate, vbFriday)
End Function
'************* Code End *************
Public Function fnCalculating_future_past_date(dtStartDate As Date, ymdFlag As String, blFuturePastFlag As Boolean _
                                               , intValue As Integer)
 Select Case blFuturePastFlag
    Case True
       Select Case ymdFlag
          Case "y"
             fnCalculating_future_past_date = DateSerial(Year([dtStartDate]) + intValue, Month([dtStartDate]), Day([dtStartDate]))
          Case "m"
             fnCalculating_future_past_date = DateSerial(Year([dtStartDate]), Month([dtStartDate]) + intValue, Day([dtStartDate]))
          Case "d"
             fnCalculating_future_past_date = DateSerial(Year([dtStartDate]), Month([dtStartDate]), Day([dtStartDate]) + intValue)
       End Select
       
    Case False
       Select Case ymdFlag
          Case "y"
             fnCalculating_future_past_date = DateSerial(Year([dtStartDate]) - intValue, Month([dtStartDate]), Day([dtStartDate]))
          Case "m"
             fnCalculating_future_past_date = DateSerial(Year([dtStartDate]), Month([dtStartDate]) - intValue, Day([dtStartDate]))
          Case "d"
             fnCalculating_future_past_date = DateSerial(Year([dtStartDate]), Month([dtStartDate]), Day([dtStartDate]) - intValue)
       End Select
 End Select

End Function
Public Function fnExtensionExcessDays(intGuidanceID As Integer, _
                   dtGuidanceStartDate As Date, dtGuidanceEndDate As Date, _
                   intExcessType As Integer) As Integer
   
Dim dtMaxAchievementEndDate As Date

   dtMaxAchievementEndDate = Nz(DMax("[AchievementEndDate]", "tblAchievement", _
                  " [GuidanceID] = " & intGuidanceID & " AND [ExcessType] = " & intExcessType))
   If dtMaxAchievementEndDate > dtGuidanceEndDate Then
      fnExtensionExcessDays = HowManyWeekDay(dtGuidanceEndDate, dtMaxAchievementEndDate, True)
'      MsgBox dtMaxAchievementEndDate & "  " & dtGuidanceEndDate & "  " & fnExtensionExcessDays _
         & "   " & intExcessType
   End If
   
End Function

Open in new window

0
 
LVL 75
ID: 35151656
"Is it good code to put resume next in err handler of that err.number 2424?"
Not really.  Need to find problem.

This is on a Report, right ?

mx
0
 

Author Comment

by:Mohammad Alsolaiman
ID: 35151690
Hain
i try

   Me.ExtensionDays.Text = Nz(fnExtensionExcessDays(Me.GuidanceID, Me.GuidanceStartDate, _
                          Me.GuidanceEndDate, 1), "1")
   Me.ExcessDays.Text = Nz(fnExtensionExcessDays(Me.GuidanceID, Me.GuidanceStartDate, _
                          Me.GuidanceEndDate, 2), "1")
but the same err message
0
 

Author Comment

by:Mohammad Alsolaiman
ID: 35151705
yes , it is a report
0
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 750 total points
ID: 35151758
On a report, it's Important when ... referring to a Control on the report in code that ... the Name of the control is *different* than the Control Source.  So for example:

If GuidanceIDis the Control Source for a Text box, then give the Name of the text box something like

txtGuidanceID

and in the Function call, use this instead:

   Me.ExtensionDays.Text = Nz(fnExtensionExcessDays(Me.txtGuidanceID, Me.GuidanceStartDate, _
                          Me.GuidanceEndDate, 1), 1)


... and so on for all the Controls being referenced in code.

Make this change and report back ...

mx
0
 
LVL 57

Expert Comment

by:HainKurt
ID: 35152107
what is happening if you replace that line with

1. Me.ExtensionDays = 0
2. Me.ExtensionDays = ""

3. Me.ExtensionDays.Value=""
4. Me.ExtensionDays.Value="0"

5. Me.ExtensionDays.Text = ""
6. Me.ExtensionDays.Text = "0"
0
 

Author Comment

by:Mohammad Alsolaiman
ID: 35153626
i try all the all the solution, but still the same problem
Private Sub ¿¿¿¿¿_Format(Cancel As Integer, FormatCount As Integer)
   Me.txtExtensionDays.Value = Nz(fnExtensionExcessDays(Me.txtGuidanceID, Me.txtGuidanceStartDate, _
                          Me.txtGuidanceEndDate, 1), "1")
   Me.txtExcessDays.Value = Nz(fnExtensionExcessDays(Me.txtGuidanceID, Me.txtGuidanceStartDate, _
                          Me.txtGuidanceEndDate, 2), "1")
End Sub

Open in new window

0
 
LVL 75
ID: 35153705
Humm. Can you upload a version that exhibits this issue ... and explain exactly how to reproduce it ?

mx
0
 

Author Comment

by:Mohammad Alsolaiman
ID: 35153802
I will in sha'allah
But it will tack some time because of the Arabic issues
0
 

Author Closing Comment

by:Mohammad Alsolaiman
ID: 35407157
sorry , no time to ubload the database, i can fegur out that the problem maybe becouse of no record found, so the value is null. i change my code to not to process when no record found.
it works
thank god
then thank you guys very much for trying help
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question