How can I refer to a fields in a recordet using a variable
soemthing like rs!variable. Is this possible
Printable View
How can I refer to a fields in a recordet using a variable
soemthing like rs!variable. Is this possible
Do you mean using a variable to get the data or do you mean when you refer to the data you already have in a recordset?
I guess both, I want to fetch the data and then update using the same method..
e.g
rs.Open "Select " & leavetype.Text & " from leavemaster where empid=" & empid.Text
rs1! & leavetype.Text=total
rs.update
Generally, you have many ways to refer to the field:
rs!FieldName
rs("FieldName")
rs.Fileds("FieldName")
rs.Fileds.Item("FieldName")
... ...
In this case the field name comes from another source, then use the second syntax:
rs(leavetype.Text)
Cannot use the first syntax.
awsome..that works..thanks