Results 1 to 5 of 5

Thread: [RESOLVED] Using variable fields in recordset

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2005
    Posts
    129

    Resolved [RESOLVED] Using variable fields in recordset

    How can I refer to a fields in a recordet using a variable
    soemthing like rs!variable. Is this possible

  2. #2

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2005
    Posts
    129

    Re: Using variable fields in 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

  4. #4
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: Using variable fields in recordset

    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.
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Feb 2005
    Posts
    129

    Re: Using variable fields in recordset

    awsome..that works..thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width