Results 1 to 12 of 12
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Run-Time error '13': (Access 97)

    I would guess that this is the notorious "Missing Reference" problem. That code runs without a hitch in my Access 97 databases.

    Open the Access 97 database, and open any module (it can be a stand-alone module or the class module behind a form or report).
    Select Tools/References...
    If there is a reference whose text begins with MISSING, uncheck the box to the left of it and click OK.
    Then try to recompile all code (Debug/Compile and Save All).

  2. #2
    2 Star Lounger
    Join Date
    Aug 2002
    Location
    Minneapolis, MN, Minnesota
    Posts
    162
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Run-Time error '13': (Access 97)

    Hello Hans,
    There are no references that begins with MISSING. <img src=/S/confused.gif border=0 alt=confused width=15 height=20>
    What particular references should be checked for this to execute properly?
    Easy Access

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Run-Time error '13': (Access 97)

    If references are not the problem, there might be a problem with the data. For instance, the function Work_Days will cause a run-time error if one of the arguments is null, or can't be converted to a date.

    When the error occurs, and you enter the de######, inspect BegDate. You can do this either by hovering the mouse over this variable in the code, or by opening the Immediate window (Ctrl+G) and typing
    ? BegDate
    If BegDate is empty or null or not a valid date, you know what causes the problem.

  4. #4
    2 Star Lounger
    Join Date
    Aug 2002
    Location
    Minneapolis, MN, Minnesota
    Posts
    162
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Run-Time error '13': (Access 97)

    When I hover over BegDate this message appears:
    BegDate = Empty
    Easy Access

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Run-Time error '13': (Access 97)

    Apparently, you are calling the Work_Days function, but the BegDate argument is not filled in. You'll have to investigate why this happens yourself...

  6. #6
    2 Star Lounger
    Join Date
    Aug 2002
    Location
    Minneapolis, MN, Minnesota
    Posts
    162
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Run-Time error '13': (Access 97)

    I have a database that has a module to calculate Work Days:

    Function Work_Days(BegDate As Variant, EndDate As Variant) As Integer
    Dim WholeWeeks As Variant
    Dim DateCnt As Variant
    Dim EndDays As Integer

    BegDate = DateValue(BegDate)
    EndDate = DateValue(EndDate)

    WholeWeeks = DateDiff("w", BegDate, EndDate)
    DateCnt = DateAdd("ww", WholeWeeks, BegDate)
    EndDays = 0
    Do While DateCnt <= EndDate
    If Weekday(DateCnt) <> 1 And Weekday(DateCnt) <> 7 Then
    EndDays = EndDays + 1
    End If
    DateCnt = DateAdd("d", 1, DateCnt)
    Loop
    Work_Days = WholeWeeks * 5 + EndDays
    End Function

    I am running Office Pro 2000. The database works fine on my system, but my client has Access 97 and whenever I try to open a report that uses the Work Day module it gives me the following error message:

    Microsoft Visual Basic
    Run-Time error '13':
    Type mismatch

    When I click on the "Debug" button it opens the Work Day module and highlights the line of code that states:

    BegDate = DateValue(BegDate)

    When I place the mouse pointer over the line of code this message appears;
    BegDate = Empty

    Can someone give me some information on why this is happening?
    Easy Access

  7. #7
    2 Star Lounger
    Join Date
    Aug 2002
    Location
    Minneapolis, MN, Minnesota
    Posts
    162
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Run-Time error '13': (Access 97)

    I am running a report based on a query that calls the Work Days Function in one of its calculations. I have Between [Enter Start Date] And [Enter End Date] as the criteria for a date field. So parameter boxes should appear to prompt a user to enter a date range. The date range entered is what I want Work Days Function to calculate.
    Is it possible for Access to allow me to enter the date parameters first and then call the Work Days Function? And if so, How?
    Easy Access

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Run-Time error '13': (Access 97)

    Do you use Work_Days([Enter Start Date], [Enter End Date])?

    If you do this in the report and it doesn't work, try computing it in the query instead. Add a column to the query:

    NumberOf Days: Work_Days([Enter Start Date], [Enter End Date])

    and refer to this field in the report.

  9. #9
    2 Star Lounger
    Join Date
    Aug 2002
    Location
    Minneapolis, MN, Minnesota
    Posts
    162
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Run-Time error '13': (Access 97)

    This is the expression I use in my query:

    StandardHours: Sum(Work_Days([Enter Start Date],[Enter End Date])*([Ratio]*8))

    Everything works fine when the datebase is on my system (I have XP and Office Pro 2000). When I use it on another person's computer (who has Windows 98 and Access '97) that is when the RTE occurs.
    Do I need to delete the Date/Time query parameters from the query since the data type of the function is an integer?
    What references needs to be checked for Access '97?
    Easy Access

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Run-Time error '13': (Access 97)

    Try this first. There should be no need to delete the parameters.

    Change the type of BegDate and EndDate to Date:

    Function Work_Days(BegDate As Date, EndDate As Date) As Integer

    And remove the two lines:

    BegDate=DateValue(BegDate)
    EndDate=DateValue(EndDate)

    Now try it again.

    <img src=/w3timages/blueline.gif width=33% height=2>

    I don't think it is a references problem any more; this usually causes syntax errors, not runtime errors.

    FYI: Access 97, by default, has the following three references checked:
    Visual Basic for Applications
    Microsoft Access 8.0 Object Library
    Microsoft DAO 3.51 Object Library.

    Access 2000 uses ADO, Access 97 doesn't, so you should uncheck references to Microsoft ActiveX Data Objects n.n Library (if checked).
    Also, if Microsoft DAO n.n Object Library is checked, with n.n > 3.51 (e.g. 3.6 or 4.0), uncheck it, click OK, select Tools/References... again, and look for Microsoft DAO 3.51 Object Library (3.5 is probably OK too), and check the corresponding box.

  11. #11
    2 Star Lounger
    Join Date
    Aug 2002
    Location
    Minneapolis, MN, Minnesota
    Posts
    162
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Run-Time error '13': (Access 97)

    Thanks for all of your help Hans. <img src=/S/bow.gif border=0 alt=bow width=15 height=15>
    I will try that out with my client and let you know if it works.
    Easy Access

  12. #12
    2 Star Lounger
    Join Date
    Aug 2002
    Location
    Minneapolis, MN, Minnesota
    Posts
    162
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Run-Time error '13': (Access 97)

    Hans,
    You have my utmost thanks and gratitude. Your suggestion worked like a charm!
    Easy Access

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •