![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
The call to a routine has started throwing an Error 13-Data Type Mismatch. But it only accepts a date and a string - both of which really are as advertised. The only goofy thing I can find is that when I hit Shift+F2 in the code window to jump to the called routine, Access throws this: http://tinyurl.com/486rcv8 - which to indicate a missing reference, except that the "reference" would be by the application to itself. Assuming that I'm not lying about the passed date really being a date and the passed ref to the string really pointing to a string, has anybody seen anything like this? This routine has been working in the past - and is used daily in production.... but not today.... -) For the masochistically-inclined: Couple screen snaps of Immediate window: -------------------------------------------------- http://tinyurl.com/6yyhbbh http://tinyurl.com/67zh6zo ------------------------------------------------- The calling code (which throws the error at line 1021) --------------------------------------------------- Private Sub txtPaymentDate_AfterUpdate() 1000 DebugStackPush Me.Name & ": txtPaymentDate_AfterUpdate" 1001 On Error GoTo txtPaymentDate_AfterUpdate_err ' PURPOSE: - To flag the date as custom ' - To determine if new date is business day ' - To notify parent that something has changed 1002 Dim S As String 1010 With DoCmd 1011 .Hourglass True 1012 .DoMenuItem acFormBar, acFile, acSaveRecord 1019 End With 1020 With Me 1021 .txtIsBizDay.Value = IsBizDay(.txtPaymentDate, S) 1022 .txtIsCustomPaymentDate.Value = True 1023 .Dirty = False 1029 End With 1030 With Me.Parent 1031 PaymentSchedule_ComputeAmounts Date, _ "ttblSecurity_PaymentAccrualDaily", _ "ttblSecurity_PaymentSchedule" 1032 .subResetSchedule.Form.Requery 1039 End With 1040 afterUpdateAllFields 1999 DoCmd.Hourglass False txtPaymentDate_AfterUpdate_xit: DebugStackPop On Error Resume Next Exit Sub txtPaymentDate_AfterUpdate_err: BugAlert True, "PaymentDate='" & Me.txtPaymentDate & "'." Resume txtPaymentDate_AfterUpdate_xit End Sub --------------------------------------------------- The called routine --------------------------------------------------- Public Function IsBizDay( _ ByVal theDate As Variant, _ ByRef theExplaination As String _ ) As Boolean 1000 DebugStackPush mModuleName & ": IsBizDay" 1001 On Error GoTo IsBizDay_err ' PURPOSE: To determine whether-or-not a given date falls on a normal ' business day in the context of banking holidays as specified ' in tlkpHoliday and weekends ' ACCEPTS: - The date in question ' - Pointer to field to which we deliver a reason for the ' date in question not being a business day ' RETURNS: True if the date in question does not fall on a weekend ' or bank holiday, else False ' 1002 Dim myExplaination As String 1010 If IsWeekDay(theDate) = False Then 1011 myExplaination = Format$(theDate, "dddd") 1012 Else 1013 If IsHoliday(theDate, myExplaination) = False Then 1014 IsBizDay = True 1015 End If 1019 End If 1999 theExplaination = myExplaination IsBizDay_xit: DebugStackPop On Error Resume Next Exit Function IsBizDay_err: BugAlert True, "" Resume IsBizDay_xit End Function --------------------------------------------------- |
#3
| |||
| |||
|
|
Well, aside from guessing that the error is occurring in the IsBizDay function (not clear why you have a Variant argument there, rather than the expected Date ...), I really can't tell any more. Can't you step through the code to figure it out? Without knowing exactly what the input arguments were, we haven't a chance in hell of determining the cause. Questions and observations |
#4
| |||
| |||
|
|
Well, aside from guessing that the error is occurring in the IsBizDay function (not clear why you have a Variant argument there, rather than the expected Date ...), I really can't tell any more. Can't you step through the code to figure it out? Without knowing exactly what the input arguments were, we haven't a chance in hell of determining the cause. |
#5
| |||
| |||
|
|
1 TxtPaymentDate sounds more like a string than a date. It's a date. The 'txt' prefix refers to the control type within |
|
2 What data type does IsBizDay return - I would have guessed boolean. |
|
3 Where you have typed ?IsBizDay(.txtpaymentdate,5) in the immediate window, you don't appear to have got a result. 4 What type of data is txtIsBizDay? Is it the same type of data as the function IsBizDay() returns? |
#6
| |||
| |||
|
|
This routine has been working in the past - and is used daily in production.... but not today.... -) |
#7
| |||
| |||
|
|
I'm gonna cross my fingers, export the form to ASCII, and then rebuild it from the text file. |
#8
| |||
| |||
|
|
Per (PeteCresswell): I'm gonna cross my fingers, export the form to ASCII, and then rebuild it from the text file. Nope..... SaveAsText ==> LoadFromText... same-old-same-old. I think I'm back to the question of why Access throws this error: http://tinyurl.com/486rcv8 when I Shift+F2 on IsBizDay() in the code of the problem form - even just in design mode... yet it does not throw the error and jumps to the routine as expected when I Shift+F2 on IsBizDay() in an Immediate window... AND .... Shift+F2 ALSO WORKS when IsBizDay() is referenced in code of a dummy form that I created in the same application. Sounds to me like I'm back to the corrupted form scenario - but somehow SaveAsText ==> LoadFromText is not resolving the corruption problem. Doesn't sound possible to me. OTOH, I don't have a clue as to the underlying processes. What happens if you make a new form, CTRL-A/Cttl-C the objects from the |
#9
| |||
| |||
|
|
I'm gonna cross my fingers, export the form to ASCII, and then rebuild it from the text file. |
#10
| |||
| |||
|
|
What happens if you make a new form, CTRL-A/Cttl-C the objects from the old form, paste into the new form, then copy the code for the old form and paste into the new form? |
![]() |
| Thread Tools | |
| Display Modes | |
| |