Is it possible to use a wildcard "*" within the Criteria portion of a DLookup function in a module?
Some background: I have a group of Excel spreadsheets that I would like to put into Access, however the data is not at all normalized. The data is currently set up with a group of items to the left, and along the top a row of months for each period in the fiscal year, with the data shown below. The sort of thing you'd find after performing a Crosstab query on normalized data. Each spreadsheet is for one fiscal year.
Unfortunately, some of the items along the left contain text for the fiscal year in question. i.e. "FY09 Budget". Because I will ultimately include all fiscal years in one table and thus all budget information in that table, I need to include that item.
This code works:
This code does not:
Is it possible to use a wildcard, or perhaps to match MOST of the field but not entirely? Any other suggestions? I suppose I could hard-code it if I have to and change the code for the FY each time, but it would be nice to be able to code it.
Thanks!
Some background: I have a group of Excel spreadsheets that I would like to put into Access, however the data is not at all normalized. The data is currently set up with a group of items to the left, and along the top a row of months for each period in the fiscal year, with the data shown below. The sort of thing you'd find after performing a Crosstab query on normalized data. Each spreadsheet is for one fiscal year.
Unfortunately, some of the items along the left contain text for the fiscal year in question. i.e. "FY09 Budget". Because I will ultimately include all fiscal years in one table and thus all budget information in that table, I need to include that item.
This code works:
Code:
budget = DLookup(mth, fromtbl, "[fieldname] = Sales Plan - FY09 Official Budget")
This code does not:
Code:
budget = DLookup(mth, fromtbl, "[fieldname] = 'Sales Plan - *'")
Is it possible to use a wildcard, or perhaps to match MOST of the field but not entirely? Any other suggestions? I suppose I could hard-code it if I have to and change the code for the FY each time, but it would be nice to be able to code it.
Thanks!