A strange one!!

dwayne dibley

Registered User.
Local time
Today, 01:42
Joined
Oct 1, 2008
Messages
26
A piece of code I have ceated refuses to work on a form on my computer only, which I thought was down to my lack of VB knoweldge.

A friend who works in programming has had a look at it and he can get the code working on his computer. But If he sends me the same file back(with the same code) it will not work on my PC.

I cant understand why this happening. I assume it must be down to my computer or the copy of access I am using.

This is the code

Private Sub returned_date_LostFocus()
Dim iDif As Integer
Dim result As Double
Dim idate1 As Date
Dim idate2 As Date
idate1 = [due_date]
idate2 = [returned_date]
iDif = DateDiff("d", [idate1], [idate2])
If iDif > 0 Then
result = iDif * 0.05
[ABC1].Value = result
End If
End Sub

I ran the code via the local windows the "result" variable outcome is correct but the text field {ABC1} will not populate the result.

Any ideas??
 
What version of Access are you using (and service pack level), and what does your friend have?
 
What version of Access are you using (and service pack level), and what does your friend have?

Microsoft 2003 SP3. I think my friend is using access 2007(but I think he used it as a 2000 file or summit)
 
Okay, you can approach this in a couple of ways.

1.
a. I would not use the lost focus event at all.
b. You could move the code to the After Update event of the returned_date control or just move the code to the button.

2. If you move it to the after update of the control, you can call it like this from the button:
Code:
Private Sub Command8_Click()
[returned_date] = Date
[B][COLOR="Red"]returned_date_AfterUpdate[/COLOR][/B]
End Sub
 
Okay, you can approach this in a couple of ways.

1.
a. I would not use the lost focus event at all.
b. You could move the code to the After Update event of the returned_date control or just move the code to the button.

2. If you move it to the after update of the control, you can call it like this from the button:
Code:
Private Sub Command8_Click()
[returned_date] = Date
[B][COLOR=red]returned_date_AfterUpdate[/COLOR][/B]
End Sub
 
 
You Sir, are the dog's danglers!!!
 
It worked, getttttttttttttt innnnnnnnnnnnnnnnnnn!!!
 
Thanks alot. Very very much[SIZE=3] [FONT=Times New Roman][FONT=Verdana][SIZE=2]Appreciated[/SIZE][/FONT] [/FONT][/SIZE]
 

Users who are viewing this thread

Back
Top Bottom