Hi Guys,
I need help with a DLookup
I'm trying to use a dlookup to assign a value based on a date so I can use this in a query later as a condition on whether or not its greater.
For example I have a table filled with Dates and values - So I've called this Tbl_Dex and it has 3 fields: ID, Day1 (Date/ Time), Exchange (Number)
so my first record is ID=1, Day1 = 01/02/2022 and Exchange = 1 The each new record increments by 1 month and exchange value increments by 1.
I then have subform query that needs a month / Year filter - for which I have used 2 text boxes, with a third hidden box turning them into a date, which is what I will use as my query condition.
The problem is, I'm trying to use a Dlookup to return the exchange value but it's not working. I've never really done dlookups on dates before, just strings. Can anyone help?
I need help with a DLookup
I'm trying to use a dlookup to assign a value based on a date so I can use this in a query later as a condition on whether or not its greater.
For example I have a table filled with Dates and values - So I've called this Tbl_Dex and it has 3 fields: ID, Day1 (Date/ Time), Exchange (Number)
so my first record is ID=1, Day1 = 01/02/2022 and Exchange = 1 The each new record increments by 1 month and exchange value increments by 1.
I then have subform query that needs a month / Year filter - for which I have used 2 text boxes, with a third hidden box turning them into a date, which is what I will use as my query condition.
The problem is, I'm trying to use a Dlookup to return the exchange value but it's not working. I've never really done dlookups on dates before, just strings. Can anyone help?
Code:
dex1 = DateSerial(Me.Text4, Me.Text2, 1)
Text11 = DLookup("Exchange", "Tbl_DEX", [day1]= & [dex1])