I use the following code to define a recordset:
strSQL = "SELECT Purchase.*, Purchase.COR_NUM FROM Purchase ORDER BY Purchase.COR_NUM;"
Set rst = dbs.OpenRecordset(strSQL)
I now want to access the field Cor_Num in the code, if I use
nNum = rst.fields(0)
it works.
However, I don't want to have to look the field number for each field I want to use. How can I refernce the field directly? I have tried several different formats and I can't seem to get anything to work. Can someone help me with the proper syntax?
Some that I've tried:
nNum = rst![Cor_Num]
nNum = rst.[Cor_Num]
nNum = rst.fields.[Cor_Num]
BTW, I'm using Access '97
strSQL = "SELECT Purchase.*, Purchase.COR_NUM FROM Purchase ORDER BY Purchase.COR_NUM;"
Set rst = dbs.OpenRecordset(strSQL)
I now want to access the field Cor_Num in the code, if I use
nNum = rst.fields(0)
it works.
However, I don't want to have to look the field number for each field I want to use. How can I refernce the field directly? I have tried several different formats and I can't seem to get anything to work. Can someone help me with the proper syntax?
Some that I've tried:
nNum = rst![Cor_Num]
nNum = rst.[Cor_Num]
nNum = rst.fields.[Cor_Num]
BTW, I'm using Access '97