VBAhole22
Registered User.
- Local time
- Today, 10:08
- Joined
- Jan 18, 2002
- Messages
- 117
I have a line of coding that pulls a value out of a table so that I can set a variable equal to it as follows:
Set rsScore = db.OpenRecordset("tbl", dbOpenSnapshot)
rsScore.FindFirst "NAME= '" & name
val_low = rsScore!LOW_VAL
val_high = rsScore!HIGH_VAL
rsScore.Close
This part works well and gives me the value in the fields "LOW_VAL" and "HIGH_VAL" from the table where the names are equal.
What I want to do now is pull the value from a field in this table that I determine at run-time and have stored in a variable. What I guessed below didn't fly:
val_low = rsScore!strWHATEVER & "_LOW"
val_high = rsScore!strWHATEVER & "_HIGH"
I want to be able to pull the value from the table based on something the user selected (the WHATEVER part).
Set rsScore = db.OpenRecordset("tbl", dbOpenSnapshot)
rsScore.FindFirst "NAME= '" & name
val_low = rsScore!LOW_VAL
val_high = rsScore!HIGH_VAL
rsScore.Close
This part works well and gives me the value in the fields "LOW_VAL" and "HIGH_VAL" from the table where the names are equal.
What I want to do now is pull the value from a field in this table that I determine at run-time and have stored in a variable. What I guessed below didn't fly:
val_low = rsScore!strWHATEVER & "_LOW"
val_high = rsScore!strWHATEVER & "_HIGH"
I want to be able to pull the value from the table based on something the user selected (the WHATEVER part).