HI, I've put this in general as the way I am doing things seems very long winded and so I was wondering if anyone had any better ideas. This is also the reason for the long explanation. For people with less time my current specific issue is the bit in bold at the end.
I was hoping someone would be able to give me some ideas on the best method to do the following.
My boss wants a great amount of felxibility on the output that can be generated by the database I'm creating primarily that any field can be compared about any other and a simple report with min max count etc with some nice graphs can be shot out.
I'm restricting this to fields in the main table "tblMainData", this table contains a lot of project data, some fields are text, some dates, some numbers and the vast majority contain IDs that are used to look up the field value from another table "tblCodeValues".
My thinking is that I have a form that the user uses to select which fields they want to analyse. This contains two list boxs. The first "lsMainCriteria" is a single select list box in which the user choses the main field they're interested in. The second "lsSubCriteria" is a multi select list box from which the user selects the fields they want to compare to the main criteria. Selections in this listbox will be limited to only those of similar datatypes (text + lookup fields, numeric, date) and then depending on the data type one of three corresponding simple generic reports will be populated with the data.
The problem I am having currently is with the lookup values as obviously the default value returned without doing a lookup is the codeID rather than the text. My first thought was to initially create a query that has all the looked up values in it and then base the rest of the process off this. However the first part of the flexibility comes from a filter by form form which works nicely off the original data but is very slow when based on a query of looked up data, so I thought I would leave the looking up of the actual values till as late in the process as possible when there will be the minimum amount of records and fields.
This is leading me to needing to include a Dlookup in an SQL statement I am constructing in VBA and I can't figure out quite where I need the quote marks to make it work. How do I write a dlookup in SQL withing VBA? I have tried:
and
and a variety of other methods and still can't get it to work.
Both followed by
(this is a bit shorter than the actual code)
so if anyone can help with the specific issues or have any suggestions on other means to perform this task it would be appreciated. I know this isn't quite how Access is designed to work and I do have a backup to export the data to Excel to let them play about with it here, but I really would like to be able to incorporate this feature, and I'm sure it can be done however long winded
I was hoping someone would be able to give me some ideas on the best method to do the following.
My boss wants a great amount of felxibility on the output that can be generated by the database I'm creating primarily that any field can be compared about any other and a simple report with min max count etc with some nice graphs can be shot out.
I'm restricting this to fields in the main table "tblMainData", this table contains a lot of project data, some fields are text, some dates, some numbers and the vast majority contain IDs that are used to look up the field value from another table "tblCodeValues".
My thinking is that I have a form that the user uses to select which fields they want to analyse. This contains two list boxs. The first "lsMainCriteria" is a single select list box in which the user choses the main field they're interested in. The second "lsSubCriteria" is a multi select list box from which the user selects the fields they want to compare to the main criteria. Selections in this listbox will be limited to only those of similar datatypes (text + lookup fields, numeric, date) and then depending on the data type one of three corresponding simple generic reports will be populated with the data.
The problem I am having currently is with the lookup values as obviously the default value returned without doing a lookup is the codeID rather than the text. My first thought was to initially create a query that has all the looked up values in it and then base the rest of the process off this. However the first part of the flexibility comes from a filter by form form which works nicely off the original data but is very slow when based on a query of looked up data, so I thought I would leave the looking up of the actual values till as late in the process as possible when there will be the minimum amount of records and fields.
This is leading me to needing to include a Dlookup in an SQL statement I am constructing in VBA and I can't figure out quite where I need the quote marks to make it work. How do I write a dlookup in SQL withing VBA? I have tried:
Code:
strLookUpSubRptQry = "DLookup([CodeNameShort], tblCodeValues, [CodeID]=[" & Me.lsSubCriteria.Column(1, varCategory) & "]) AS Field" & k
Code:
strLookUpSubRptQry = "DLookup('[CodeNameShort]', 'tblCodeValues', '[CodeID]=' [" & Me.lsSubCriteria.Column(1, varCategory) & "]) AS Field" & k
and a variety of other methods and still can't get it to work.
Both followed by
Code:
StrFullSQL = "SELECT [ProjectID], " & strLookUpSubRtpQry & " FROM qryFiltered
so if anyone can help with the specific issues or have any suggestions on other means to perform this task it would be appreciated. I know this isn't quite how Access is designed to work and I do have a backup to export the data to Excel to let them play about with it here, but I really would like to be able to incorporate this feature, and I'm sure it can be done however long winded