Dear,
I have a Query with the name 'Finale Capaciteit' that holds 3 columns:
column1: Datum (contains a date)
column2: Totale Forecast VM (contains a number)
column3: Totale Forecast NM (contains a number)
This query is populated with data.
In the 'on click' event of a Command Button on a Form, I want to retrieve data form this Query, so my code in vba looks like:
Dim Datum As Date
Datum = DateSerial(Keuzelijst602.Value, 1, BeginOfMonthJan) ----> here I populate the variable Datum with the date that must be lookup'ed in the Query and return the corresponding value in column [Totale Forecast VM]"
Capacity = DLookup("[Totale Forecast VM]", "[Finale Capaciteit]", "[Finale Capaciteit].Datum=Datum")
Although the query contains data different from 0 for a given date, my Dlookup function ALWAYS returns 0 ....while the corresponding column [Totale Forecast VM] contains data <> 0
Is the code wrong?
Thank you in advance
Kind regards,
Bart