assign value to field with VBA

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.
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top