Hi There
I use code like the following to create virtual recordsets in my modules that allows me to manipulate data very easily and make my database very versatile.
=================================================
Set BOMdb = DBEngine.Workspaces(0).Databases(0)
Set Monthset = BOMdb.OpenRecordset("tblMonths", DB_OPEN_TABLE)
Monthset.MoveFirst
Do While Not Monthset.EOF
varMonthName = Monthset![MonthName]
Monthset.MoveNext
Loop
====================================================
However what I really would find useful is to be able to specify the fieldname (shown in red) from a variable.
I have tried replacing the fieldname with a variable in the usual format as below but it never works
varFieldname = "November"
varMonthName = Monthset![" & varFieldname & "]
Anybody have any suggestions on how I can do this as it would save a lot of lines of code.
Pastymann
I use code like the following to create virtual recordsets in my modules that allows me to manipulate data very easily and make my database very versatile.
=================================================
Set BOMdb = DBEngine.Workspaces(0).Databases(0)
Set Monthset = BOMdb.OpenRecordset("tblMonths", DB_OPEN_TABLE)
Monthset.MoveFirst
Do While Not Monthset.EOF
varMonthName = Monthset![MonthName]
Monthset.MoveNext
Loop
====================================================
However what I really would find useful is to be able to specify the fieldname (shown in red) from a variable.
I have tried replacing the fieldname with a variable in the usual format as below but it never works
varFieldname = "November"
varMonthName = Monthset![" & varFieldname & "]
Anybody have any suggestions on how I can do this as it would save a lot of lines of code.
Pastymann