Hi, I have the following code
Dim RecordSet As DAO.Recordset
Set RecordSet = CurrentDb.OpenRecordset("Select * from tblGlobalData ORDER BY [Model], [Nationality Group], [Total Revenue Curr PEriod] DESC;")
Total = RecordSet![Total Revenue Curr Period]
Nationality = RecordSet![Nationality Group]
Market = RecordSet![Model]
However I want to create a generic field variable so that I can reuse the code for a number of field e.g
Dim RecordSet As DAO.Recordset
Set RecordSet = CurrentDb.OpenRecordset("Select * from tblGlobalData ORDER BY [Model], [Nationality Group], [" & GenericField & "] DESC;")
Total = RecordSet!GenericField
Nationality = RecordSet![Nationality Group]
Market = RecordSet![Model]
Any idea on how I can do this?
thanks
Cage
Dim RecordSet As DAO.Recordset
Set RecordSet = CurrentDb.OpenRecordset("Select * from tblGlobalData ORDER BY [Model], [Nationality Group], [Total Revenue Curr PEriod] DESC;")
Total = RecordSet![Total Revenue Curr Period]
Nationality = RecordSet![Nationality Group]
Market = RecordSet![Model]
However I want to create a generic field variable so that I can reuse the code for a number of field e.g
Dim RecordSet As DAO.Recordset
Set RecordSet = CurrentDb.OpenRecordset("Select * from tblGlobalData ORDER BY [Model], [Nationality Group], [" & GenericField & "] DESC;")
Total = RecordSet!GenericField
Nationality = RecordSet![Nationality Group]
Market = RecordSet![Model]
Any idea on how I can do this?
thanks
Cage