Database Variable Problems
i need to assign variables from a recordset called from an SQL statement but i can't figure out how to change the Field Name bit to a variable .... i've tried all sorts of bracket combinations, etc but to no avail. is this possible at all?
EG:
VarToBeAssigned = RstRecordSet![NeedToHaveVarInHere]
Re: Database Variable Problems
Try:
VarToBeAssigned = RstRecordSet![<FIELD_NAME in database>]
Re: Database Variable Problems
are you looking for this?
dim varFieldName as string
varFieldName= "A_field_name"
varToBeAssigned= rsRecordset(varFieldName).value
Warning: the recordset maybe a null value, so
varToBeAssigned better be variant!
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
Re: Database Variable Problems
thanks a lot ... it was the .value bit that i was missing to sort that out