assign value to field with VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hello,

i have written a line of VBA code to calculate the difference (in days)
between two dates. then i want VBA to insert the code in a form in Access.
this is the code i have written:

DAYS_LATE.value = DateDiff("d', RETURN_DATE.value, DUE_DATE.value)

however the VBA compiler has immediately highlighted 'RETURN_DATE' and
prompted me with the following message:

Compile error:
Expected: expression

i have knowledge in Visual Basic (version 2003 onwards) but have never
programmed in VBA before.

using any available method (VBA or non-VBA), how can i calculate the
difference between two days and assign the output to a field in an Access
table?

thanks very much.
 
Try:

Me.DAYS_LATE = DateDiff("d', Me.RETURN_DATE, Me.DUE_DATE)

This assumes DAYS_LATE etc. are text boxes on your form.

Cheers.

BW
 
Back
Top