Error in code? dateDifForStart.....

alexFMCL

New member
Local time
Today, 23:03
Joined
Sep 7, 2010
Messages
3
Have not worked with Access for a long while, and therefore any knowledge I previously had has now completely dissapeared (hopefully only temporarily, though). One of my colleagues has come accross a problem whilst using the database we have here.

The text highlighted in blue was the text highlighted in the VBE when the error occured.

Any ideas as to what my colleague has done to recieve this error message, and how to overcome it/prevent it from happening again?

Many thanks for your help, it is greatly appreciated :)

Alex



' MsgBox "Recordset EOF: " & recordSet.EOF, vbOKOnly, "Recordset"
While Not recordSet.EOF
Dim recVatrate As Double
Dim recStart As String
Dim recEnd As String
recVatrate = CDbl(recordSet(1))
recStart = recordSet(2)


Dim dateDifForStart As Integer
Dim dateDifForEnd As Integer

dateDifForStart = DateDiff("d", CDate(recStart), recordDate)
If IsNull(recordSet(3)) Then
dateDifForEnd = -2

Else
recEnd = recordSet(3)
dateDifForEnd = DateDiff("d", CDate(recEnd), recordDate)
End If

If dateDifForStart >= 0 And dateDifForEnd <= 0 Then
If Not IsNull(costExVat) Then
If typeVatable Then
If Not LostReciept Then
If costExVat Then
calculateVat = staffCost * recVatrate
Else
calculateVat = staffCost - (staffCost / (recVatrate + 1))
End If
 
Hi there and welcome to the forum.
What error occurs at the indicated line?
 
Hi lagbolt, thanks for the reply and the welcome :)

I am not sure, i have contacted my colleague but am still waiting for a reply - all i was supplied with was a screenshot of the problem which had the indicated line highlited in yellow.

I don't suppose you can determine what the problem might be from reading the indicated code can you?

In the meantime I will work on getting a copy of the error message! :)

Many thanks
 
What is the actual error message? That could help us figure things out (since we aren't actually there to see it).
 
Lagbolt, Bob,

The error message reads:

'Compile error:
Sub or Function not defined'



We also have a further issue when filling in a form where a repeated error message occurs stating:

'Microsoft Visual Basic
Run-time error '6':
Overflow'


Any help on either issues would be greatly appreciated.

Best Regards,
Alex
 
Your error report is not consistent: You can't have a compile error AND a yellow highlight. The yellow highlight means code is running, but code that won't compile won't run.
The compile error and the unknown error in your original post are not the same.
Overflow occurs if you assign a value to variable that is not big enough to accept that value ....
Code:
dim tmp as byte
[COLOR="Green"]'causes overflow[/COLOR]
tmp = 256
You need to be quite skeptical, IMO, of error reports from your users. To understand/describe/solve an error you pretty much need to be able to cause it to occur.
 

Users who are viewing this thread

Back
Top Bottom