dcsimg
Results 1 to 3 of 3

Thread: [RESOLVED] string columnname and using with rst![stringedcolumnname]

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    90

    Resolved [RESOLVED] string columnname and using with rst![stringedcolumnname]

    Hello there,

    i've stringed a Columnname from a particular table

    e.g,

    Dim sQ As String

    sQ = List2.ItemData(List2.ListIndex) '(e.g, value "Set Up")

    'prior exists an SQL

    List1.AddItem rst![sQ]

    However, an error message "Item cannot be found in the...." appeared.

    How can i successfully string the column name, and still use it with rst![stringed-column-name]?

    Note: MS Access VBA 03

    Thanks

    Astro

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,353

    Re: string columnname and using with rst![stringedcolumnname]

    You need to use the alternative method of specifying field names, eg:

    List1.AddItem rst.fields(sQ)

    for a known field name you would do this:

    List1.AddItem rst.fields("fieldname")

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    90

    Re: string columnname and using with rst![stringedcolumnname]

    and si_the_geek strikes again

    =)

    Astro

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width