Paul has attended:
Access VBA course
Dlookup
I've done lots of dlookups before but don't understand why this one isn't working.
I have a table called tblMonths which contains the fields MonthAndYear (content e.g. "September 2008" in text) and PriorMonth (number - single format, contents e.g. 200809)
This table is used successfully to populate cmbTeam on form frmTeamKPIs.
The dlookup reads:
=DLookUp("[PriorMonth]","[tblMonths]","[MonthAndYear] = " & """ & forms.frmTeamKPIs.cmbMonth & """)
I get a blank field when trying to run.
Can you help??
Thanks
Paul
RE: Dlookup
Hi Paul
I hope I undersatand your question correctly and that the field MonthAndYear contains text in the same format as cmbMonth on the form.
Building a criteria to look in a text field I would usually use a single quote, ie
=DLookUp("[PriorMonth]","[tblMonths]","[MonthAndYear] = '" & forms.frmTeamKPIs.cmbMonth & "'")
If that doesn't work try doing a debug.print of the criteria to make sure it looks okay.
Let me know how you get on.
Laura