Hi all, I'm hoping you can help before a hole appears in my wall....:banghead:
I am trying to use the DLookup function in a form. I have a few unbound boxes which have calculations in them to show dates based on another field. Now I need to have a DLookup to pull a value associated with that date into another field.
For example:-
Freqency = "3" (years)
Month 1 = "01/01/2016"
Month 2 = (unbound with calculation): =DateAdd("yyyy",[Frequency],[Month1])
Month 3 = (unbound with calculation): =DateAdd("yyyy",[Frequency],[Month2])
Now, I have a separate table (tblSalesTotals) with a list of dates and a value associated with that date (i.e., 2 columns, "SalesMonthDate", "SalesMonthTotalValue"). The date is the last date of the month and the value is the total quantity for that month. None of the fields are linked to the main database tables.
I want to be able to have:-
MonthTotal = (look up "Month1" date in tblSalesTotals against "SalesMonthDate" and return the corresponding value from the "SalesMonthTotalValue" column).
This would let me add a date in "Month1" and then autopopulate the other fields to show the same sales totals in that month in the previous x years (depending on the value of "Frequency").
I cannot seem to get it to work and cannot understand the DLookup function at all! I can do it quite easily in Excel using VLookup but can't in Access.
Is anyone able to help?
I am trying to use the DLookup function in a form. I have a few unbound boxes which have calculations in them to show dates based on another field. Now I need to have a DLookup to pull a value associated with that date into another field.
For example:-
Freqency = "3" (years)
Month 1 = "01/01/2016"
Month 2 = (unbound with calculation): =DateAdd("yyyy",[Frequency],[Month1])
Month 3 = (unbound with calculation): =DateAdd("yyyy",[Frequency],[Month2])
Now, I have a separate table (tblSalesTotals) with a list of dates and a value associated with that date (i.e., 2 columns, "SalesMonthDate", "SalesMonthTotalValue"). The date is the last date of the month and the value is the total quantity for that month. None of the fields are linked to the main database tables.
I want to be able to have:-
MonthTotal = (look up "Month1" date in tblSalesTotals against "SalesMonthDate" and return the corresponding value from the "SalesMonthTotalValue" column).
This would let me add a date in "Month1" and then autopopulate the other fields to show the same sales totals in that month in the previous x years (depending on the value of "Frequency").
I cannot seem to get it to work and cannot understand the DLookup function at all! I can do it quite easily in Excel using VLookup but can't in Access.
Is anyone able to help?